题解 | #变种水仙花#
变种水仙花
https://www.nowcoder.com/practice/c178e3f5cc4641dfbc8b020ae79e2b71
#include <stdio.h> int main() { int i, a, b, c, d; for (i = 10000; i <= 99999; i++) //可以拆成1和0000 10和000 100和00 1000和0 { a = (i / 10000) * (i % 10000); b = (i / 1000) * (i % 1000); c = (i / 100) * (i % 100); d = (i / 10) * (i % 10); if ((a + b + c + d) == i) { printf("%d ", i); } } return 0; }