全WA了(但样例对的)
查看原帖
全WA了(但样例对的)
1742930
Pan807楼主2025/8/2 12:37
#include<bits/stdc++.h>
using namespace std;
int y(string s) {
	bool f=true;
	for(int i=0; i<=s.size()/2; i++) {
		for(int j=s.size()-1; j>=s.size()/2; j--) {
			if(s[i]!=s[j]) {
				f=false;
			}
		}
	}
	if(f) {
		return 1;
	} else {
		return 0;
	}
}
int main() {
	int n;
	cin>>n;
	while(n--) {
		string s;
		cin>>s;
		bool t=true;
		for(int i=2; i+1<s.size(); i++) {
			string a=s.substr(0,i);
			string b=s.substr(i);
			if(y(a)==1&&y(b)==1) {
				t=true;
				break;
			}else{
				t=false;	
			}
		}
		if(t){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
}
2025/8/2 12:37
加载中...