Cod sursa(job #918761)

Utilizator AleAnd95Musat Andreea Alexandra AleAnd95 Data 19 martie 2013 09:28:33
Problema Combinari Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <iostream>
#include <fstream>
using namespace std;
ofstream out("combinari.out");
ifstream in("combinari.in");
int s[19],n,m;

void scrie() {
int i;
for(i=1;i<=m;i++)
 out<<s[i]<<" ";
out<<'\n';
}

void init(int k) {
if(k==1) s[k]=0;
else s[k]=s[k-1];
}

void bkt(int k) {

if(k==m+1) scrie();
else {
init(k);
while(s[k]<n-m+k) {
s[k]++;
bkt(k+1);

}
}

}


int main()
{
  in>>n>>m;
  bkt(1);
}