题解 | #变种水仙花#
变种水仙花
https://www.nowcoder.com/practice/c178e3f5cc4641dfbc8b020ae79e2b71
#include <stdio.h>
#include <math.h>
int main()
{
int i = 0;
for (i=10000;i<100000; i++)
{
int sum = 0;
int n = 4;
while (n)
{
int k = i;
int tmp = pow(10, n);
sum += (k / tmp) * (k % tmp);
n = n - 1;
}
if (sum == i)
{
printf("%d ", i);
}
}
return 0;
}


查看17道真题和解析