#include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
int i, frist;
i = frist = 1;
while(i < n)
{
frist *= 10;
i++;
}
//printf("%d", frist);
i = frist;
while(i < frist * 10)
{
int t = i;
int sum = 0;
do{
int a = t % 10;
t /= 10;
int b = 1,p = a;
while(b<n)
{
p *= a;
b++;
}
sum += p;
}while(t>0);
if(sum == i)
{
printf("水仙花数是%d\n", i);
}
i++;
}
return 0;
}
06-09
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交