Pagini recente » Cod sursa (job #1775249) | Cod sursa (job #2846669) | Cod sursa (job #503569) | Cod sursa (job #588344) | Cod sursa (job #2817044)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
int n, cnt;
bool u[17];
void bk(int k) {
if (k == n+1) {
cnt++;
if (cnt == 1)
return;
for (int j = 1; j <= k; j++)
if (u[j]) fout << j << " ";
fout << "\n";
}
else {
bk(k+1);
u[k] = 1;
bk(k+1);
u[k] = 0;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
fin >> n;
bk(1);
return 0;
}