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