qbhbh @ 2024-12-05 20:48:34
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>s;
}
string a;
s=a;
reverse(a.begin(),a.end());
for(int i=1;i<=n;i++){
if(a==s){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
}
代码求调 解决互关
by Il1_1_3 @ 2024-12-05 20:53:03
@qbhbh
把
string a;
s=a;
reverse(a.begin(),a.end());
for(int i=1;i<=n;i++){
if(a==s){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
放到读入的那个循环里
by qbhbh @ 2024-12-05 21:03:34
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>s;
string a;
s=a;
reverse(a.begin(),a.end());
for(int i=1;i<=n;i++){
if(a==s){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
}
}
这样吗