Pagini recente » Cod sursa (job #72512) | Cod sursa (job #1125818) | Cod sursa (job #663068) | Cod sursa (job #2479185) | Cod sursa (job #1275655)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("combinari.in");
ofstream fout ("combinari.out");
int n,x[19],m;
void tipar (int k)
{
for(int i=1;i<=k;i++)
fout<<x[i]<<" ";
fout<<'\n';
}
void comb(int k)
{
for(int i=x[k-1]+1;i<=n;i++)
{
x[k]=i;
if(k==m)
tipar(k);
else
{
comb(k+1);
}
}
}
int main()
{
fin>>n>>m;
comb(1);
return 0;
}