回文数 题解:string一下完了
#include<bits/stdc++.h>
using namespace std;
int main(){
string k1,k2;
int n;
while(cin>>k1){
k2.clear();
n=k1.length();
for(int i=n-1;i>=0;i--){
k2.push_back(k1[i]);
}
if(k1==k2){
cout<<"true"<<endl;
}else{
cout<<"false"<<endl;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发