|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 |
#include <iostream>#include <cstring>#include <cmath>using
namespace
std;void
HUI(int
num){ int
k,i,j,x,y,z; for(i=1;i<=9;i++) for(j=0;j<=9;j++) for(x=0;x<=9;x++) for(y=0;y<=9;y++) for(z=0;z<=9;z++) if(i+j+z+x+y==num) if(z==i&&y==j) cout<<i<<j<<x<<y<<z<<endl; for(k=1;k<=9;k++) for(i=0;i<=9;i++) for(j=0;j<=9;j++) for(x=0;x<=9;x++) for(y=0;y<=9;y++) for(z=0;z<=9;z++) if(k+i+j+z+x+y==num) if(z==k&&y==i&&x==j) cout<<k<<i<<j<<x<<y<<z<<endl;}int
main(){ int
n; while(cin>>n) { HUI(n); } return
0;} |
代码仅供参考
原文:http://www.cnblogs.com/MonkeyAC/p/3532902.html