文章

81

粉丝

0

获赞

282

访问

11.0k

头像
回文数 题解:string一下完了
P1712 重庆大学机试题
发布于2025年3月15日 21:36
阅读数 112

#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;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发