求助 样例1输出 ”0x4aa100“
查看原帖
求助 样例1输出 ”0x4aa100“
756598
Euphonium_楼主2022/9/25 14:56

rt

代码:

#include <bits/stdc++.h>

using namespace std;

int n,sum=0;

bool games[6];
bool teacher_comes = false;
bool is_there_any_student_playing_games=false;

string students[6];
string teachers[4];
string students_playing_games[6];
string students_been_caught[6];
string students_been_caughted[6];
string if_come=" came!";
string if_left=" left!";
string student_continue_playing_games=" started playing games!";
string student_stop_playing_games=" stopped playing games!";
string news;

int main()

{	

	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//FASTTTTTTTTTTTTTTTT cin & cout
	
	cin>>n;
	
	for(int i=1;i<=3;i++)
	{
		cin>>teachers[i];
	}
	
	for(int i=1;i<=5;i++)
	{
		cin>>students[i];
	}
	
	getline(cin,news);
	for(int i=1;i<=n;i++)
	{
		
		getline(cin,news);
		
		for(int y=1;y<=3;y++)
		{
			
			if(teachers[y]+if_come == news)//老师来了吗 
			{
				
				teacher_comes = true;
				break;
				
			}
			
		}
		
		for(int y=1;y<=3;y++)
		{
			
			if(teachers[y]+if_left == news)//老师走了吗 
			{
				
				teacher_comes = false;
				break;
				
			}
			
		}
		
		for(int y=1;y<=5;y++)
		{
			
			if(students[y]+student_continue_playing_games == news)//有人van游戏吗 
			{
				
				is_there_any_student_playing_games=true;
				students_playing_games[y]=students[y];
				break;
				
			}
			
		}
		
		for(int y=1;y<=5;y++)
		{
			
			if(students[y]+student_stop_playing_games == news)//有人不想再van了吗 
			{
				
				is_there_any_student_playing_games=false;
				students_playing_games[y]="";
				break;
				
			}
			
		}
		if(is_there_any_student_playing_games && teacher_comes)
		{
			
			for(int y=1;y<=5;y++)
			{
			 	
			 	if((students_playing_games[y] != students_been_caughted[y]) && (students_playing_games[y] != ""))//有没有被抓到? 
			 	{
			 		
			 		students_been_caught[++sum]=students_playing_games[y];
			 		students_been_caughted[y]=students_been_caught[y];
			    }
				
			}
		
		}
		
	}
	
	sort(students_been_caught,students_been_caught+sum);
	for(int i=0;i<sum;i++)
	{
		cout<<students_been_caught<<' ';//问题来源(不一定(? 
	}
	cout<<endl;
	if(sum==0)
	{
		
		cout<<"How Good Oiers Are!"<<endl;
		
	}
	if(sum==5)
	{
		cout<<"How Bad Oiers Are!"<<endl;
	}
}
2022/9/25 14:56
加载中...