'commit'
This commit is contained in:
17
RuMenJingDian/LiTi/P_2_1.cpp
Normal file
17
RuMenJingDian/LiTi/P_2_1.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user