17 lines
419 B
C++
17 lines
419 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
ios::sync_with_stdio(false); //读入输出优化的强迫症 ~~~
|
|
//水仙花数
|
|
for (int i = 100; i < 999; i++) {
|
|
int a = i / 100;
|
|
int b = i / 10 % 10;
|
|
int c = i % 10;
|
|
if (pow(a, 3) + pow(b, 3) + pow(c, 3) == (100 * a + b * 10 + c)) {
|
|
cout << i << endl;
|
|
}
|
|
}
|
|
return 0;
|
|
} |