A7851.完成回文数判定函数 题解
2025-09-21 12:59:09
发布于:浙江
0阅读
0回复
0点赞
#include <iostream>
using namespace std;
bool is_pal(int n){
int x = 0, y = n; //x用于储存n的颠倒过来的数
while (y!=0){
x = x*10+y%10 ;
y = y/10;
}
if (x==n){
return true;
}else{
return false;
}
}
int main(){
int n;
cin >> n;
if (is_pal(n))
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
这里空空如也







有帮助,赞一个