#include <stdio.h>
#include <string.h>
int judge(int num) {
int ge, shi, bai;
ge = num % 10;
shi = num / 10 % 10;
bai = num / 100;
if (ge * ge * ge + shi * shi * shi + bai * bai * bai == num)
return 1;
else return 0;
}
int
main(int argc, char **argv) {
int start, end;
int res[1000];
int i;
int cnt;
while (scanf("%d%d", &start, &end) == 2) {
cnt = 0;
memset(res, 0, sizeof(res));
for (i = start; i <= end; ++ i) {
if (judge(i)) {
res[cnt++] = i;
}
}
if (cnt == 0) printf("no\n");
else {
for (i = 0; i < cnt - 1; ++ i)
printf("%d ", res[i]);
printf("%d\n", res[cnt - 1]);
}
}
return 0;
}
HDU2010 水仙花数
最新推荐文章于 2021-05-21 21:08:17 发布