题解:P11395 喵喵喵幼儿园
Tendo_Alice
·
·
题解
题解:P11395 喵喵喵幼儿园
传送门
题目分析:
### 思路:
按顺序去判断两个字符串,只要有一个字符串不是 ```eat``` 那就输出,否则输出 ```or```。
### Code:
```
#include<bits/stdc++.h>
#define IOSO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define endl '\n'
#define QwQ return 0;
using namespace std;
int main(){
IOSO;
int n;
cin>>n;
string eat="eat";
for(int i=1;i<=n;i++){
string A,B,C;
cin>>A>>C>>B;
string word=B.substr(0,B.size()-1);//删除字符串后面的?
if(A!=eat){//如果A字符串不是eat,那就输出A
cout<<A<<endl;
}else if(word!=eat){//如果B字符串不是eat,那就输出B
cout<<word<<endl;
}else{//如果两个字符串都是eat,那就输出or
cout<<"or"<<endl;
}
}
QwQ;
}
```