Cod sursa(job #3226620)
Utilizator | Data | 22 aprilie 2024 12:04:56 | |
---|---|---|---|
Problema | Submultimi | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.5 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in ("submultimi.in");
ofstream out ("submultimi.out");
int n;
int x;
int main()
{
ios_base :: sync_with_stdio(false);
in.tie(NULL);
in >> n;
for(int i = 1; i < (1 << n); i ++)
{
x = i;
for(int j = 1; j <= n; j ++)
{
if(x % 2)
{
cout << j << " ";
}
x /= 2;
}
cout << '\n';
}
return 0;
}