Cod sursa(job #467397)
| Utilizator | Data | 28 iunie 2010 17:36:17 | |
|---|---|---|---|
| Problema | Combinari | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include<fstream.h>
long n,x[100],m;
void cit()
{ifstream fin("combinari.in");
fin>>n>>m;
fin.close();
}
ofstream fout("combinari.out");
void afis()
{long i;
for(i=1;i<=m;i++)
fout<<x[i]<<' ';
fout<<'\n';
}
void back(long k)
{long i;
if(k>m)
afis();
else
for(i=x[k-1]+1;i<=n;i++)
{x[k]=i;
back(k+1);
}
}
int main()
{cit();
back(1);
fout.close();
return 0;
}
