只循环一次
#include<stdio.h>
#include<math.h>
int main(void)
{
int i=1, n, x,len;
float s=0;
while(i<1000)
{
len=log10(i)+1;//len为i的位数
x=i;
while(x>0)
{
s+=pow(x%10,len);
x=x/10;
}
if(s==i)
printf("%d\n", i);
i++;
}
}