-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path441.cpp
More file actions
39 lines (38 loc) · 780 Bytes
/
441.cpp
File metadata and controls
39 lines (38 loc) · 780 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
#include <bits/stdc++.h>
using namespace std;
int a[20];
bool view[20];
vector<int> v;
int n;
void call(int m) {
if (v.size() == 6) {
for (int i = 0; i < 6; i++) {
if (i != 0) printf(" ");
printf("%d", v[i]);
}
puts("");
return;
}
for (int i = m; i < n; i++) {
if (!view[i]) {
view[i] = 1;
v.push_back(a[i]);
call(i + 1);
v.pop_back();
view[i] = 0;
}
}
return;
}
int main() {
int i, j = 0;
while (scanf("%d", &n)) {
memset(view, 0, sizeof(view));
if (n == 0) return 0;
for (i = 0; i < n; i++) scanf("%d", &a[i]);
if (j != 0) puts("");
call(0);
j++;
}
return 0;
}