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