Pagini recente » Cod sursa (job #2047860) | Cod sursa (job #962431) | Cod sursa (job #191179) | Cod sursa (job #252130) | Cod sursa (job #2091255)
#include <bits/stdc++.h>
using namespace std;
long long int number, limit;
ifstream fin ("submultimi.in");
ofstream fout ("submultimi.out");
int main(){
fin >> number;
char binaryRepresentation[5];
limit = (1<<number)-1;
for ( int index = 1; index <= limit; index++){
itoa(index, binaryRepresentation, 2);
for ( int character = strlen(binaryRepresentation)-1; character > -1; character-- )
if ( binaryRepresentation[character] == '1')
fout << strlen(binaryRepresentation) - character << " ";
fout << "\n";
}
return 0;
}