社区讨论

要帮帮捏~

P4896OIer们的烦恼参与者 6已保存回复 10

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
10 条
当前快照
1 份
快照标识符
@lys5thcp
此快照首次捕获于
2024/07/19 11:47
2 年前
此快照最后确认于
2024/07/20 11:19
2 年前
查看原帖
这道题好坏,一直找不出问题滴,好急呢
只拿了 90 分,我要崩溃了呜呜呜,快哭了
CPP
#include<bits/stdc++.h>
#define _rep(i,a,b) for(int i=(a);i<=(b);i++)
#define _antirep(i,a,b) for(int i=(a);i>=(b);i--) 
using namespace std;
typedef long long LL;
typedef double db;
const int N=1e5+5,mod=1e9+7;
int n,cnt;
string teacher[6],student[6],pp;
bool f[6],nows[6],nowt=false; 
signed main()
{        
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>n;
	_rep(i,1,3) cin>>teacher[i];
	_rep(i,1,5) cin>>student[i];
//	getline(cin,pp);
	_rep(pos,1,n)
	{ 
		//cout<<pos<<endl;
		string a,b;
		cin>>a;
		int ok=0;
		_rep(i,1,3) if(a==teacher[i]) ok=1;
		_rep(i,1,5) if(a==student[i]) ok=2; 
		getline(cin,b); 
		if(ok==0) 
		{
			continue;
		}
		if(ok==1)
		{
			if(b==" came!")
			{ 
				_rep(i,1,3)
				{
					if(a==teacher[i])
					{
						nowt=true;
						break;
					}
				}
			}
			if(b==" left!")
			{ 
				_rep(i,1,3)
				{
					if(a==teacher[i])
					{
						nowt=false;
						break;
					}
				}
			}
		}
		if(ok==2)
		{
			if(b==" started playing games!")
			{	  
				_rep(i,1,5)
				{
					if(a==student[i])
					{
						nows[i]=1;
						break;
					}
				}
			}
			if(b==" stopped playing games!")
			{ 
				_rep(i,1,5)
				{
					if(a==student[i])
					{
						nows[i]=0;
						break;
					}
				}
			} 
		}
		if(nowt)_rep(i,1,5)f[i]|=nows[i];
	} 
	int res=0;
	_rep(i,1,5) if(f[i]) cout<<student[i]<<" ",cnt++;
	if(cnt==0) cout<<"How Good Oiers Are!";
	else if(cnt==5) cout<<"\nHow Bad Oiers Are!";
	return 0;
}

回复

10 条回复,欢迎继续交流。

正在加载回复...