Cod sursa(job #2762297)

Utilizator AndreiStreheStreche Andrei Claudiu AndreiStrehe Data 6 iulie 2021 12:39:39
Problema Submultimi Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.4 kb
#include <fstream>

using namespace std;

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

int n,v[17];
void back(int x)
{
    for (int i=v[x-1]+1;i<=n;i++)
    {
        v[x]=i;

            for(int j=1;j<=x;j++)
                g<<v[j]<<" ";
            g<<'\n';
            back(x+1);
    }
}

int main()
{
    f>>n;

        back(1);

   f.close();
   g.close();
}