Cod sursa(job #1791502)

Utilizator medicinedoctoralexandru medicinedoctor Data 29 octombrie 2016 14:05:33
Problema Submultimi Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.48 kb
#include <vector>
#include <algorithm>
#include <fstream>
//#include <iostream>

using namespace std;

ifstream cin("submultimi.in");
ofstream cout("submultimi.out");

int n;

void bin(string x)
{
    if (x.size()==n)
    {
        for (int i=0; i<x.size(); i++)
        {
            if (x[i]=='1') cout << i+1 << ' ';
        }
        cout << '\n';
    }
    else
    {
        bin(x+'1');
        bin(x+'0');
    }
}

main()
{
    cin >> n;
    bin("");
}