暴力模拟
2024-05-14 21:39:14
发布于:广东
12阅读
0回复
0点赞
吓死我了,还以为之前存的代码找不到了
还好还能用
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
int t, n;
cin >> t;
while(t--){
bool flagm = 0, flage = 0, flago = 0, flagw = 0, ff = 0;
int n;
cin >> n;
string a;
cin >> a;
int len = a.length();
for(int i = 0; i < len; i++){
if(!flagm){
if(a[i] != 'm' && a[i] != 'M'){
cout << "NO\n";
ff = 1;
break;
}flagm = 1;
continue;
}if(!flage){
if(a[i] == 'm' || a[i] == 'M'){
continue;
}
if(a[i] != 'e' && a[i] != 'E'){
cout << "NO\n";
ff = 1;
break;
}
flage = 1;
continue;
}if(!flago){
if(a[i] == 'e' || a[i] == 'E'){
continue;
}
if(a[i] != 'o' && a[i] != 'O'){
cout << "NO\n";
ff = 1;
break;
}
flago = 1;continue;
}
if(a[i] == 'o' || a[i] == 'O'){
continue;
}
if(a[i] != 'w' && a[i] != 'W'){
cout << "NO\n";
ff = 1;
break;
}flagw = 1;
}if(ff) continue;
if(flagm && flage && flago && flagw) cout << "YES\n";
else cout << "NO\n";
}
return 0;
}
全部评论 1
36
2024-07-08 来自 广东
0
有帮助,赞一个