Cod sursa(job #1753451)

Utilizator MateiMCCiurezu Matei MateiMC Data 6 septembrie 2016 16:08:55
Problema Combinari Scor 80
Compilator cpp Status done
Runda Arhiva educationala Marime 0.48 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("combinari.in");
ofstream fout("combinari.out");
int n,k,st[20],p;


void afisare(){
    for(int i=1; i<=k; i++){
        fout<<st[i]<<" ";
    }
    fout<<endl;
}


void back1(int p){
    for(st[p]=p; st[p]<=n; st[p]++){
        if(st[p]>st[p-1]){
            if(p==k){
                afisare();
            }
            else back1(p+1);
        }
    }
}


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

    return 0;
}