只对了一半 (T-T)
查看原帖
只对了一半 (T-T)
767417
Serendi_Pity楼主2022/9/8 21:58
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
int main(){
    char c[105];
    int a,i;
    cin>>c;
    int l=strlen(c);
    if(l%2==0){
        for(i=l/2;i>=0;i--){
            if(c[i]==c[i+l]){
                a++;
            }
        }
    }else{
        c[l%2+l/2]=0;
        for(i=l/2;i>=0;i--){
            if(c[i]==c[i+l]){
                a++;
            }
        }
    }
    if(a==l/2){
        cout<<"yes";
    }else{
        cout<<"no";
    }
    
}
2022/9/8 21:58
加载中...