Cod sursa(job #771331)
Utilizator | Data | 25 iulie 2012 17:02:33 | |
---|---|---|---|
Problema | Combinari | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <fstream>
using namespace std;
ifstream d("combinari.in");
ofstream o("combinari.out");
int n,k,s[20];
void scr()
{
int j;
for (j=1;j<=k;j++) o<<s[j]<<' ';
o<<'\n';
}
void comb(int h)
{
int i=1;
if (h>k) {scr();}
else for (i=s[h-1]+1;i<=n;i++) {s[h]=i; comb(h+1);}
}
int main()
{
d>>n>>k;
comb(1);
}