如果输入3就打印出所有三位数的水仙花数
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
int first = 1;
int i = 1;
while (i < n) {
first *= 10;
i++;
//TODO
}
/*printf("first=%d\n",first);*/
i = first;
while (i < first * 10) {
int t = i;
int sum = 0;
do {
int d = t % 10;
t /= 10;
int p = d;
int j = 1;
while (j < n) {
p *= d;
j++;
//TODO
}
sum += p;
} while (t > 0);
if (sum == i) {
printf("%d\n", i);
//TODO
}
i++;
}
return 0;
}