Cod sursa(job #3038595)

Utilizator DomnulMilandruMilandru Nicon-David DomnulMilandru Data 27 martie 2023 16:00:26
Problema Submultimi Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb

#include <fstream>

using namespace std;
ifstream cin("submultimi.in");
ofstream cout("submultimi.out");
int sol[17],fr[17],n;
void afisare(int poz)
{
    for(int i=1;i<=poz;i++)
      cout<<sol[i]<<" ";
    cout<<'\n';
}
void bkt(int poz)
{
    if(poz==n+1)
      return;
    for(int i=sol[poz-1]+1;i<=n;i++)
    {
        sol[poz]=i;
        afisare(poz);
        bkt(poz+1);
    }
}
int main()
{
    cin>>n;
    bkt(1);

    return 0;
}