1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <iostream> using namespace std; int d(int number) { int sum = number; while (number != 0) { sum = sum + (number % 10); number = number / 10; } return sum; } int main() { bool check[10001] = { false, }; for (int i = 1; i < 10001; i++) { int n = d(i); if (n < 10001) check[n] = true; } for (int i = 1; i < 10001; i++) if (!check[i]) cout << i << “\n”; return 0; } | cs |