Cod sursa(job #3366340)

Utilizator AndreiEnacheTheGoatAndrei Iancu Enache AndreiEnacheTheGoat Data 30 septembrie 2026 19:15:22
Problema Submultimi Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <bits/stdc++.h>

using namespace std;

int n;
const int NMAX = 16;
int v[NMAX + 5];

void afis(int poz)
{
    int i;
    for(i = 1; i <= poz; i ++)
        cout << v[i] << " ";
    cout << "\n";
}

void bk(int poz)
{
   int i;
   for(i = v[poz - 1] + 1; i <= n; i ++)
   {
       v[poz] = i;
       afis(poz);
       bk(poz + 1);
   }
}

int main()
{
    cin >> n;
    bk(1);
    return 0;
}