-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6603.cpp
More file actions
64 lines (53 loc) · 885 Bytes
/
6603.cpp
File metadata and controls
64 lines (53 loc) · 885 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* @file 6603.cpp
* @brief 로또
* @author Sam Kim (samkim2626@gmail.com)
*
* 조합(combination)
* kC6 k개 중에서 6개 뽑기
* DFS?
*/
#include <iostream>
#include <vector>
using namespace std;
#define r 6
int k;
int s[13];
int arr[13];
void comb(int start, int depth)
{
if (depth == r)
{
for (int i = 0; i < r; i++)
{
cout << arr[i] << ' ';
}
cout << '\n';
return;
}
for (int i = start; i < k; i++)
{
arr[depth] = s[i];
comb(i + 1, depth + 1);
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
while (1)
{
cin >> k;
if (k == 0)
{
break;
}
for (int i = 0; i < k; i++)
{
cin >> s[i];
}
comb(0, 0);
cout << '\n';
}
return 0;
}