/*************************************************************************
> File Name: main.c
> Author:
> Mail:
> Created Time: Tue 27 Oct 2020 04:49:20 PM CST
************************************************************************/
#include<stdio.h>
int isPalindrome(int x) {
if (__builtin_expect(!!(x < 0), 0)) return 0;
int y = 0, z = x;
while (x) {
y = y * 10 + x % 10;
x /= 10;
}
return z == y;
}
int main() {
int n;
while (scanf("%d", &n) != EOF) {
if (isPalindrome(n)) printf("YES!\n");
else {
printf("NO!\n");
}
}
return 0;
}
回文整数
最新推荐文章于 2023-03-07 20:53:45 发布