-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path441 Lotto.cpp
More file actions
54 lines (50 loc) · 1.17 KB
/
Copy path441 Lotto.cpp
File metadata and controls
54 lines (50 loc) · 1.17 KB
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
//============================================================================
// Name : Riham.cpp
// Author : Remo
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define Set(v,d) memset(v, d, sizeof(v))
#define oo 1000000007 //infinity
#define F first
#define S second
#define pb push_back
#define sz(x) (int)(x.size())
#define all(x) (x.begin()),(x.end())
#define rall(x) (x.rbegin()),(x.rend())
#define pi 3.1415926536
const int MAX = 15;
int n, arr[MAX];
void Lotto(string s, int sum){
if(sz(s) == n){
if(sum == 6){
vector<int>ans;
for(int i=0;i<sz(s);i++)
if(s[i] == '1') ans.pb(arr[i]);
for(int i=0;i<sz(ans) - 1;i++)
printf("%d ", ans[i]);
printf("%d", ans[sz(ans)-1]);
puts("");
}
return;
}
Lotto(s+'1', sum+1);
Lotto(s+'0', sum);
}
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
scanf("%d", &n);
while(n){
for(int i=0;i<n;i++) scanf("%d", &arr[i]);
Lotto("", 0);
scanf("%d", &n);
if(n)
puts("");
}
return 0;
}