Cod sursa(job #266324)
Utilizator | Data | 25 februarie 2009 11:39:28 | |
---|---|---|---|
Problema | Combinari | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include<fstream.h>
ifstream f("combinari.in");
ofstream g("combinari.out");
int st[20],n,k;
void tip(int y){
int i;
for(i=1;i<=y;i++)
g<<st[i];
g<<"\n";}
void back(int x){
int i;
for(i=st[x-1]+1;i<=n;i++){
st[x]=i;
if(x==k)
tip(k);
else back(x+1); }}
int main(){
f>>n>>k;
st[0]=0;
back(1);
f.close();
g.close();
return 0;}