-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsubset.cpp
More file actions
42 lines (37 loc) · 674 Bytes
/
subset.cpp
File metadata and controls
42 lines (37 loc) · 674 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
#include<bits/stdc++.h>
using namespace std;
#define wt while(true)
vector<int>subset;
int n=7;
void search_(int first = 0, subset)
{
if(k == n+1)
{
for(auto x: subset)
cout<<x;
}
else
{
subset.push_back(k);
search_(k+1);
}
}
int main()
{
freopen("input.txt", "r", stdin);
freopen("op.txt", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n;
for(int i=0; i<n; i++)
{
int a;
cin>>a;
arr[i]=a;
}
while(n--)
search_(n);
for(auto x: subset)
cout<<x<<" ";
return 0;
}