Cod sursa(job #2679846)
| Utilizator | Data | 1 decembrie 2020 18:02:10 | |
|---|---|---|---|
| Problema | Combinari | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("combinari.in");
ofstream fout ("combinari.out");
int n, k;
int a[20];
void bacc(int nivel)
{
if(nivel == k+1)
{
for(int i = 1; i <= k; i++)
fout << a[i] << " ";
fout << "\n";
return;
}
for(a[nivel] = a[nivel-1]+1; a[nivel] <= n; a[nivel]++)
bacc(nivel+1);
}
int main()
{
fin >> n >> k;
bacc(1);
return 0;
}
