求助
  • 板块学术版
  • 楼主_huangyicheng_
  • 当前回复0
  • 已保存回复0
  • 发布时间2020/12/31 18:52
  • 上次更新2023/11/5 05:27:21
查看原帖
求助
356928
_huangyicheng_楼主2020/12/31 18:52

AT1237

#include<iostream>
using namespace std;
string s[5005];
bool f[5005];
int n=1;
int main(){
	while(cin>>s[n]) n++;
	for(int i=1;i<=n;i++){
		if(s[i]=="not"){
			int cnt=0;
			for(int j=i;j<=n;j++){
				if(s[j]=="not") cnt++;
				else break;
			}
			if(cnt%2==0){
				for(int j=i;j<=i+cnt-1;j++){
					f[j]=true;
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!f[i]) cout<<s[i]<<" ";
	}
	return 0;
}
2020/12/31 18:52
加载中...