Cod sursa(job #1553119)
Utilizator | Data | 19 decembrie 2015 12:10:09 | |
---|---|---|---|
Problema | Combinari | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include <fstream>
using namespace std;
ifstream f("combinari.in");
ofstream g("combinari.out");
int n,sol[21],m;
void afis()
{
int i;
for (i=1;i<=m;i++)
{
g<<sol[i]<<" ";
}
g<<'\n';
}
void backk(int k)
{
int i;
if (k>m)
{
afis();
}
else
{
for (i=sol[k-1]+1;i<=n;i++)
{
sol[k]=i;
backk(k+1);
}
}
}
int main()
{
f>>n>>m;
backk(1);
return 0;
}