Cod sursa(job #785626)
| Utilizator | Data | 9 septembrie 2012 14:23:17 | |
|---|---|---|---|
| Problema | Combinari | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
//#include "stdafx.h"
#include <fstream>
using namespace std;
short n,m,k,x[21];
ifstream f("combinari.in"); ofstream g("combinari.out");
inline void afis()
{for(int i=1; i<=n; i++) g<<x[i]<<" ";
g<<"\n";
}
void back()
{k=1; x[k]=0;
do {while(1+x[k]<=m-n+k)
{x[k]++;
if(k == n) afis();
else {k++; x[k]=x[k-1];};
}
k--;
}
while(k);
}
int main()
{f>>m>>n;
back();
return 0;
}
