Pagini recente » Cod sursa (job #2823185) | Monitorul de evaluare | Cod sursa (job #1422512) | Cod sursa (job #2591240) | Cod sursa (job #1202674)
//#include <iostream>
#include<fstream>
#include<string>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;
ifstream cin("combinari.in");
ofstream cout("combinari.out");
int i,n,k,v[100];
void afisare(){
for(i=1;i<=k;i++){
cout<<v[i]<<' ';
}
cout<<'\n';
}
void bck(int nivel){
if(nivel==k){
afisare();
v[k]=0;
return;
}
for(int j=v[nivel]+1;j<=n-k+nivel+1;j++){
v[nivel+1]=j;
bck(nivel+1);
}
}
int main()
{
cin>>n>>k;
bck(0);
return 0;
}