Cod sursa(job #1639994)

Utilizator justsomedudePalade Thomas-Emanuel justsomedude Data 8 martie 2016 15:13:52
Problema Submultimi Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
#include<iostream>
#include<fstream>
#define MOD 1999999973

using namespace std;

ifstream fin  ("submultimi.in");
ofstream fout ("submultimi.out");

int n, st[13];

void Afisare()
{
    for (int i=1; i<=n; i++)
        if (st[i]) fout << i << " ";
    fout << "\n";
}

void Back(int top)
{
    int i;
    if (top == n+1) Afisare();
    else
      for (i=0; i<=1; i++)
      {
          st[top] = i;
          Back(top+1);
      }
}


int main ()
{
  fin >> n;
  Back(1);
  fin.close();
  fout.close();
  return 0;
}