Mai intai trebuie sa te autentifici.
Cod sursa(job #190344)
Utilizator | Data | 21 mai 2008 16:19:24 | |
---|---|---|---|
Problema | Combinari | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.63 kb |
#include<fstream.h>
int n,k,v[20];
fstream f("combinari.in", ios::in);
fstream g("combinari.out", ios::out)
void citire()
{
f>>n>>k;
f.close();
}
void afis()
{
int i;
for(i=1;i<=k;i++)
fout<<v[i]<<' ';
fout<<'\n';
}
void comb(int p)
{
int i;
if(p==k+1)
afis();
else
for(i=v[p-1]+1;i<=n;i++)
{
v[p]=i;
comb(p+1);
}
}
int main()
{
citire();
comb(1);
g.close();
return 0;
}