0分求助

B4039 [GESP202409 三级] 回文拼接

qbhbh @ 2025-01-01 09:27:04

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string s;
    for(int i=1;i<=n;i++)
        cin>>s;
    string a;
    a=s;
    reverse(a.begin(),a.end());
    for(int i=1;i<=n;i++){
        if(a[i]==s[i]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

by zzhengxi @ 2025-01-01 11:02:44

@qbhbh 交错题了吧


by zzhengxi @ 2025-01-01 11:04:10

以及string的输入可以这样写:

string s;
cin >> s;

不用加循环。


by zzhengxi @ 2025-01-01 11:05:19

@qbhbh


by bugmaker3243 @ 2025-01-01 11:05:57

@qbhbh 循环没打大括号,并且每个字符串长度不是 n


by zzhengxi @ 2025-01-01 11:16:13

@qbhbh n是数据的组数


|