Cod sursa(job #337561)

Utilizator pykhNeagoe Alexandru pykh Data 4 august 2009 00:28:58
Problema Combinari Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 kb
#include<stdio.h>

const char in[]="combinari.in";
const char out[]="combinari.out";

int n, k, v[19];

void write()
	{int i;
	for(i=1;i<=k;++i)
			printf("%d ",v[i]);
		printf("\n");
	}
	
void back(int y)
	{int i;
		if(y==k+1)write();
		else for(i=v[y-1]+1;i<=n;++i)
		{
			v[y]=i;
			back(y+1);
		}
	}
		
int main()
		{
			freopen(in,"r",stdin);
			freopen(out,"w",stdout);
			scanf("%d %d", &n, &k);
			back( 1 );
			return 0;
	}