30分求助!
查看原帖
30分求助!
494699
卷王慢即快楼主2023/1/18 16:22
#include <bits/stdc++.h>
using namespace std;
int n, num = 0;
bool play[17];
string s;
string te[17], stu[17];
char call[233337];
bool vis[17];
char s1[100] = " came!";
char s2[100] = " left!";
char s3[100] = " stopped playing games!";
char s4[100] = " started playing games!";
int main()
{
	cin >> n;
	for(int i = 1; i <= 3; i++) cin >> te[i];
	for(int i = 1; i <= 5; i++) cin >> stu[i];
	sort(stu + 1, stu + 5 + 1);
	while(n--)
	{
		bool flag = 0;
		cin >> s;
		cin.getline(call, sizeof(call));
		for(int i = 1; i <= 3; i++)
			if(te[i] == s)
			{
				if(!strcmp(call, s1)) flag = 1;
				if(!strcmp(call, s2)) flag = 0;
			}
		for(int i = 1; i <= 5; i++)
			if(stu[i] == s)
			{
				if(!strcmp(call, s3)) play[i] = 0;
				if(!strcmp(call, s4)) play[i] = 1;
			}
		if(!flag) continue;
		for(int i = 1; i <= 5; i++)
			if(play[i] == 1 && !vis[i])
			{
				num++;
				vis[i] = 1;
			}
		if(num == 5) break;
	}
	bool f = 0;
	for(int i = 1; i <= 5; i++)
		if(vis[i]) cout << stu[i] << " ", f = 1;
	if(f == 1) cout << endl;
	if(num == 0) cout << "How Good Oiers Are!";
	if(num == 5) cout << "How Bad Oiers Are!";
	return 0;
}
2023/1/18 16:22
加载中...