基础练习 特殊的数字
1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 #include <cstdio> 5 #include <cmath> 6 #include <stack> 7 #include <map> 8 #include <queue> 9 10 using namespace std; 11 12 void solve() 13 { 14 for(int i = 100; i <= 999; ++ i) 15 { 16 int temp = i, ans = 0; 17 while(temp) 18 { 19 int temp1 = temp % 10; 20 ans += temp1 * temp1 * temp1; 21 temp /= 10; 22 } 23 if (ans == i) 24 printf("%d\n", i); 25 } 26 return ; 27 } 28 29 int main() 30 { 31 solve(); 32 return 0; 33 }