Cod sursa(job #2289557)
| Utilizator | Data | 24 noiembrie 2018 20:20:13 | |
|---|---|---|---|
| Problema | Submultimi | Scor | 80 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.4 kb |
#include <fstream>
using namespace std;
int N;
int main() {
ifstream iff("submultimi.in");
ofstream off("submultimi.out");
iff >> N;
for (int i = 1; i <= (1 << N) - 1; ++i) {
int j = i;
int ix = 0;
while (j) {
if ((1 << ix) & j) {
off << ix + 1 << " ";
j &= ~(1 << ix);
}
ix++;
}
off << endl;
}
return 0;
}
