Pagini recente » Cod sursa (job #73834) | Cod sursa (job #1284377) | Cod sursa (job #2041930) | Cod sursa (job #1493868) | Cod sursa (job #2687312)
#include <bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)
#define FILES freopen("submultimi.in" , "r" , stdin) , freopen("submultimi.out" , "w" , stdout)
using namespace std;
int n;
bool a[20];
void bkt(int k)
{
if(k == n + 1)
{
bool ok = 0;
for(int i = 1 ; i <= n ; i++)
if(a[i])
cout << i << ' ' , ok = 1;
if(ok)
cout << '\n';
}
else
{
a[k] = 0;
bkt(k + 1);
a[k] = 1;
bkt(k + 1);
}
}
signed main()
{
#ifndef ONLINE_JUDGE
FastIO , FILES;
#endif
cin >> n;
bkt(1);
return 0;
}