Cod sursa(job #1129214)

Utilizator bogdanpaunFMI Paun Bogdan Gabriel bogdanpaun Data 27 februarie 2014 20:47:04
Problema Combinari Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <fstream>

using namespace std;

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

int n,k,st[20];

void afis(){
    for(register int i=1;i<=k;++i) g<<st[i]<<" ";
    g<<'\n';
}

void b(int h){
    while( st[h] < n ){
        st[h]++;
        if( h == k  ) afis();
        else {
            st[h+1]=st[h] ;
            b(h+1);}
    }
}

int main()
{
    f>>n>>k;
    b(1);

    return 0;
}