Cod sursa(job #881429)
Utilizator | Data | 17 februarie 2013 22:47:35 | |
---|---|---|---|
Problema | Combinari | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include<cstdio>
using namespace std;
int n,i=1,x[20],k;
void bkt()
{
int j;
if(i==k+1)
{
for(j=1;j<=k;++j)
printf("%d ",x[j]);
printf("\n");
}
else
for(j=x[i-1]+1;j<=n-k+i;++j)
x[i]=j,++i,bkt(),--i;
}
int main()
{
//freopen("combinari.in","r",stdin);freopen("combinari.out","w",stdout);
scanf("%d%d",&n,&k);
bkt();
}