- 判断字符串是否为回文
思路
- 2025-2-7 14:27:14 @
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int len = s.size();
for(int i=0,j=len-1;i<=len/2;i++,j--){
if(s[i]!=s[j]){
cout<<"no"<<endl;
return 0;
}
}
cout<<"yes"<<endl;
return 0;
}
0 条评论
目前还没有评论...
信息
- ID
- 228
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 4
- 标签
- 递交数
- 62
- 已通过
- 29
- 上传者