标签:typedef htm https == 回文数 flag html ref while
#include <stdio.h>
#define SIZE 50
typedef enum bool Bool;
enum bool {
false, true
};
int main()
{
int n, i, j;
Bool flag = false;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
int a[SIZE] = {0};
j = 0;
int tmp = i;
while (tmp != 0)
{
a[j++] = tmp % 2;
tmp /= 2;
}
int x;
for (x = 0; x < j; x++) {
if (a[i] != a[j-x-1]) {
flag = true;
break;
}
}
if (flag == false) {
printf("%d\n", i);
}
}
return 0;
}
参考:https://zhidao.baidu.com/question/585449561561135765.html
标签:typedef htm https == 回文数 flag html ref while
原文地址:https://www.cnblogs.com/yejiaxing-01/p/13394510.html