Cod sursa(job #2280903)
Utilizator | Data | 11 noiembrie 2018 12:43:09 | |
---|---|---|---|
Problema | Combinari | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream fin("combinari.in");
ofstream fout("combinari.out");
int x[9];
int n,m;
void tipar(int k)
{
for(int i=1;i<=k;i++)
fout<<x[i]<<' ';
fout<<'\n';
}
void back(int k)
{
for(int i=x[k-1]+1;i<=n;i++)
{
x[k]=i;
if(k==m)
tipar(k);
else
back(k+1);
}
}
int main()
{
fin>>n>>m;
back(1);
}