Cod sursa(job #2028086)

Utilizator KleinWolfPop Dan Andrei KleinWolf Data 27 septembrie 2017 09:45:43
Problema Combinari Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.49 kb
#include <iostream>
#include <fstream>

using namespace std;
ifstream in ("combinari.in");
ofstream out ("combinari.out");

int n,k,comb[19],pas;

void combinari(int pas)
{
    if (pas>k)
    {
        for (int j=1;j<=k;j++)
            out<<comb[j]<<" ";
        out<<"/n";
    }
    else
    {
        for(int i=comb[pas-1]+1;i<=n;i++)
        {
            comb[pas]=i;
            combinari(pas+1);
        }
    }
}
int main()
{
    in>>n>>k;
    combinari(1);
}