35分求调
查看原帖
35分求调
1192648
LHX_18460366315楼主2024/3/25 19:54
#include<bits/stdc++.h>
using namespace std;

char zf[5] = {'a', 'e', 'i', 'o', 'u'};

bool bv(char ch) {
	for (int i = 0;i < 5;i++) {
		if (ch == zf[i]) return true;
	}
	return false;
}

int main(){
	long long n,q;
	bool shuchu = false;
	string s1;
	cin >> n >> q;
	string c[n + 5],s[q + 5];
	for (int i = 1;i <= n;i++){
		cin >> c[i];
	}
	for (int i = 1;i <= q;i++){
		cin >> s[i];
	}
	
	for (int i = 1;i <= q;i++){
		int cnt = 0;
		for (int j = 1;j <= n;j++){
			long long xiabiao = s[i].find(c[j]);
			if (xiabiao != s[i].npos){
				cnt++;
			}
			if (j == 1) continue;
			else {
				if (s1 == c[j]){
					cnt--;
				}
			}
			if (cnt > 1){
				shuchu = false;
			}
			string s1 = c[j];
		}
		if (cnt == 1){
			cout << "Yes, Commander" << endl;
		}else {
			cout << "No, Commander" << endl;
		}
		shuchu = false;
	}
	
    return 0;
}

2024/3/25 19:54
加载中...