WA50/kk
查看原帖
WA50/kk
240165
西卡洛斯楼主2021/4/21 19:44
#include <bits/stdc++.h>
using namespace std;
int n,cnt;
string teh[10],stu[10],ans[10];
bool teh1[10],stu1[10],f=0,vis[10];
int main()
{
	string str;
	scanf("%d",&n);
	for(int i=1;i<=3;i++) cin>>teh[i];
	for(int i=1;i<=5;i++) cin>>stu[i];
	sort(stu+1,stu+6);
	for(int j=1;j<=n;j++)
	{
		getline(cin,str);
		for(int i=1;i<=3;i++)
		{
			if(teh[i]+" came!"==str) teh1[i]=1;	
			if(teh[i]+" left!"==str) teh1[i]=0;
		}
		for(int i=1;i<=5;i++)
		{	
			if(stu[i]+" started playing games!"==str) stu1[i]=1;
			if(stu[i]+" stopped playing games!"==str) stu1[i]=0;
		}
		for(int i=1;i<=3;i++) if(teh1[i]) f=true;
		for(int i=1;i<=5;i++)
		{
			if(f&&stu1[i]&&!vis[i])
	  	  	{
	  	  		ans[++cnt]=stu[i];
				vis[i]=true;
		  	}
		}
	}
	if(cnt==0) {cout<<"How Good Oiers Are!";return 0;}
	for(int i=1;i<=cnt;i++) cout<<ans[i]<<" ";
	if(cnt==5) cout<<"\nHow Bad Oiers Are!";
	return 0;
}
2021/4/21 19:44
加载中...