Cod sursa(job #1175093)
| Utilizator | Data | 24 aprilie 2014 14:19:35 | |
|---|---|---|---|
| Problema | Combinari | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <fstream>
using namespace std;
int c[59];
int n,k;
ifstream fin("combinari.in");
ofstream fout("combinari.out");
inline void afisare()
{
int j;
for(j=1;j<=k;j++) fout<<c[j]<<" ";
fout<<"\n";
}
inline void gencomb(int j,int i)
{
if(j-1!=i)
{
for(int r=c[j-1]+1;r<=n-i+j;r++)
{
c[j]=r;
gencomb(j+1,i);
}
}
else afisare();
}
int main()
{
fin>>n>>k;
gencomb(1,k);
}
