You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
403 B
17 lines
403 B
#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;
|
|
} |