Cod sursa(job #1650460)

Utilizator dragosmdvMoldovan Dragos dragosmdv Data 11 martie 2016 18:29:00
Problema Combinari Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.52 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("combinari.in");
ofstream fout("combinari.out");


int n,k, v[1500], aux;
void solutie(){
for(int i=0;i<k;i++)
fout<<v[i]<<" ";
fout<<'\n';
}

void bk(int poz){
if (poz==k){
    solutie();

}
else {
        if(poz==0)
        {aux=1;
        }
        else aux=v[poz-1]+1;
    for(int i=aux;i<=n;i++)
    {v[poz]=i;
        bk(poz+1);
        }

}




}


int main(){
fin>>n>>k;

bk(0);



    return 0;
    }