Cod sursa(job #3155185)

Utilizator PetraPetra Hedesiu Petra Data 7 octombrie 2023 16:21:29
Problema Combinari Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.54 kb
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

ifstream fin ("combinari.in");
ofstream fout ("combinari.out");

int n, k;
vector<int> v;
void back()
{
    if (v.size() == k)
    {
        for (int j = 0; j < v.size(); j++)
            fout << v[j] << " ";
        fout << "\n";
    }
    for (int j = (v.size()==0 ? 1 : v[v.size()-1] + 1); j <= n; j++)
    {
        v.push_back(j);
        back();
        v.pop_back();
    }
}

int main()
{
    fin >> n >> k;
    back();
    return 0;
}