Pagini recente » Cod sursa (job #118213) | Cod sursa (job #1135914) | Cod sursa (job #2538554) | Cod sursa (job #2455748) | Cod sursa (job #2573798)
#include <bits/stdc++.h>
#define nMax 100005
#define p(x) (1<<x)
using namespace std;
ifstream fin("combinari.in");
ofstream fout("combinari.out");
int n, m, st[20];
bitset<20> ap;
void bkt(int k)
{
for(int x=st[k-1]+1; x<=n; x++)
{
st[k]=x;
if(!ap[st[k]])
{
ap[st[k]]=1;
if(k==m)
for(int i=1; i<=k; i++)
fout << st[i] << " \n"[i==k];
else
bkt(k+1);
ap[st[k]]=0;
}
}
}
int main()
{
fin >> n >> m;
bkt(1);
return 0;
}