Cod sursa(job #3189435)
Utilizator | Data | 5 ianuarie 2024 14:15:37 | |
---|---|---|---|
Problema | Submultimi | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
int n;
bool ok[16];
void bkt(int step) {
if (step == n) {
bool has = false;
for (int i = 0; i < n; i++) {
if (ok[i]) {
has = true;
fout << i + 1 << ' ';
}
}
if (has) {
fout << '\n';
}
} else {
bkt(step + 1);
ok[step] = true;
bkt(step + 1);
}
}
int main() {
fin >> n;
bkt(0);
return 0;
}