Pagini recente » Cod sursa (job #1448615) | Cod sursa (job #2912747) | Cod sursa (job #165454) | Cod sursa (job #86681) | Cod sursa (job #603041)
Cod sursa(job #603041)
#include<cstdio>
using namespace std;
int i,n,k,c[20],j;
void back(int poz){
if(poz==k+1){
for(j=1;j<=k;++j){
printf("%d ",c[j]);
}
printf("\n");
return;
}
for(int i=c[poz-1]+1;i<=n;++i){
c[poz]=i;
back(poz+1);
}
}
int main(){
freopen("combinari.in", "r",stdin);
freopen("combinari.out","w",stdout);
scanf("%d%d",&n,&k);
back(1);
return 0;
}