Pagini recente » Utilizatori inregistrati la FMI No Stress 3 | preONI 2008 - Clasament Runda 4, Clasa a 10-a | Cod sursa (job #3284173) | Cod sursa (job #3274233) | Cod sursa (job #3284177)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("combinari.in");
ofstream fout("combinari.out");
/**
*/
int n, st[20], k;
bitset<20> ap;
void Write()
{
for(int i = 1; i <= k; i++)
fout << st[i] << " ";
fout << "\n";
}
void Back(int top)
{
if(top == k + 1) Write();
else for(int i = st[top - 1] + 1; i <= n - k + top; i++)
{
st[top] = i;
Back(top + 1);
}
}
int main()
{
int i, j;
fin >> n >> k;
Back(1);
return 0;
}