AC代码 | 一看就会
2024-12-23 13:45:22
发布于:广西
2阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
bool is_pal(int n)
{
int a = 0,b = n;
while(n != 0)
{
a = a * 10 + n % 10;
n /= 10;
}
if(b == a)
{
return true;
}
return false;
}
int main()
{
int n;
cin >> n;
if(is_pal(n) == true)
{
cout << "Yes" << endl;
}
else
{
cout << "No" << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个