Cod sursa(job #2372430)
Utilizator | Data | 7 martie 2019 09:15:53 | |
---|---|---|---|
Problema | Combinari | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | pregatire_cls12_oji | Marime | 0.49 kb |
#include <fstream>
using namespace std;
ifstream in("submultimi.in");
ofstream out("submultimi.out");
int stiva[20], N, K;
void BKT(int nivel)
{
if(nivel == K + 1)
{
for(int i = 1; i <= K; i++)
out << stiva[i] << " ";
out << "\n";
}
else
for(int i = stiva[nivel - 1] + 1; i <= N - K + nivel; i++)
{
stiva[nivel] = i;
BKT(nivel + 1);
}
}
int main()
{
in >> N >> K;
BKT(1);
return 0;
}