Cod sursa(job #177775)
Utilizator | Data | 13 aprilie 2008 16:34:22 | |
---|---|---|---|
Problema | Combinari | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include<fstream.h>
int st[100],k,n;
ifstream f("combinari.in");
ofstream g("combinari.out");
void comb(int l)
{
int i;
if(l==k)
{
for(i=1;i<=k;i++)
g<<st[i]<<" ";
g<<"\n";
}
else
for(i=st[l]+1;i<=n;i++)
{
st[l+1]=i;
comb(l+1);
}
}
int main()
{
f>>n>>k;
comb(0);
return 0;
}