题解 | #水仙花数#
水仙花数
https://www.nowcoder.com/practice/dc943274e8254a9eb074298fb2084703
#include <stdio.h>
int main()
{
int a, b;
int m, n, o;
int j;
int count = 0;
while((scanf("%d %d",&a, &b))!=EOF)
{
for(int i = a; i<=b; i++)
{
j = i;
m = j%10;
j/=10;
n = j%10;
j/=10;
o = j%10;
if(i==(m*m*m+n*n*n+o*o*o))
{
printf("%d ",i);
count++;
}
}
if(count==0)
printf("no\n");
else
printf("\n");
}
return 0;
}