Cod sursa(job #3192278)
Utilizator | Data | 11 ianuarie 2024 22:55:14 | |
---|---|---|---|
Problema | Submultimi | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.5 kb |
#include <fstream>
using namespace std;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
int n;
int main(){
fin >> n;
int p = 1;
for (int i = 1; i <= n; i++){
p *= 2;
}
int ct = 1;
while (ct < p){
int aux = ct;
int i = n;
while (aux != 0){
if ( aux % 2 == 1 )
fout << i << " ";
i--;
aux /= 2;
}
ct++;
fout << "\n";
}
return 0;
}