Cod sursa(job #2372422)

Utilizator dey44andIoja Andrei-Iosif dey44and Data 7 martie 2019 09:13:38
Problema Submultimi Scor 100
Compilator cpp-64 Status done
Runda pregatire_cls12_oji Marime 0.46 kb
#include <fstream>

using namespace std;

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

int stiva[20], N;

void BKT(int nivel)
{
    if(nivel > 1)
    {
        for(int i = 1; i < nivel; i++)
        out << stiva[i] << " ";
        out << "\n";
    }
    for(int i = stiva[nivel - 1] + 1; i <= N; i++)
    {
        stiva[nivel] = i;
        BKT(nivel + 1);
    }
}

int main()
{
    in >> N;
    BKT(1);
    return 0;
}