Cod sursa(job #560272)
Utilizator | Data | 18 martie 2011 13:37:09 | |
---|---|---|---|
Problema | Submultimi | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <fstream>
using namespace std;
int N;
int main()
{
ifstream f("submultimi.in");
ofstream g("submultimi.out");
f >> N;
for (int i = 1; i < (1 << N); ++ i)
{
for (int j = 0; j < N; ++ j)
if (i & (1 << j))
g << j + 1 << " ";
g << '\n';
}
f.close();
g.close();
return 0;
}