|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 |
#include <iostream>#include <cstring>#include <cmath>using
namespace
std;void
daffodil(){ int
x,y,z; for(x=1;x<=9;x++) for(y=0;y<=9;y++) for(z=0;z<=9;z++) { if((x*x*x+y*y*y+z*z*z)==(x*100+y*10+z)) cout<<x<<y<<z<<endl; }}int
main(){ daffodil(); return
0;} |
此代码仅供参考
原文:http://www.cnblogs.com/MonkeyAC/p/3532943.html