-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6603.cpp
More file actions
45 lines (39 loc) · 718 Bytes
/
Copy path6603.cpp
File metadata and controls
45 lines (39 loc) · 718 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
int n;
int data[50];
bool flag[50];
void getSix(int x, int count){
if(count>=6){
for(int i=1; i<=50; i++){
if(flag[i]==true){
printf("%d ", data[i]);
}
}
printf("\n");
}
else{
for(int i=x; i<=n; i++){
if(flag[i]==false){
flag[i]=true;
getSix(i, count+1);
flag[i]=false;
}
}
}
}
int main() {
//Please Enter Your Code Here
while(1){
scanf("%d", &n);
if(n==0) break;
for(int i=0; i<50; i++){
flag[i]=false;
}
for(int i=1; i<=n; i++){
scanf("%d", &data[i]);
}
getSix(1, 0);
printf("\n");
}
return 0;
}