Cod sursa(job #1536369)
| Utilizator | Data | 26 noiembrie 2015 00:35:00 | |
|---|---|---|---|
| Problema | Submultimi | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
// http://www.infoarena.ro/problema/submultimi
#include <fstream>
#include <iostream>
using namespace std;
int main(int argc, const char *argv[])
{
ifstream f{"submultimi.in"};
ofstream g{"submultimi.out"};
int n;
f >> n;
int nsets = 1 << n;
unsigned int set = 1;
for (int i = 0; i < nsets - 1; i++) {
for (int j = 0; j < n; j++) {
if ((set & (1 << j)))
g << j + 1 << " ";
}
g << '\n';
set += 1;
}
return 0;
}
