Cod sursa(job #2642080)

Utilizator dream3rDavid Pop dream3r Data 13 august 2020 17:06:14
Problema Combinari Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.49 kb
//#include "pch.h"
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <queue>
using namespace std;
ifstream f("combinari.in");
ofstream o("combinari.out");
int n, p;
int v[20];



void bkt(int k)
{
	if (k == p)
	{
		for (size_t i = 0; i < k; i++)
		{
			o << v[i] << " ";
		}
		o << "\n";
	}
	else
	{
		for (size_t j = v[k - 1] + 1; j <= n; j++)
		{
			v[k] = j;
			bkt(k + 1);
		}
	}
}


int main()
{
	f >> n >> p;
	bkt(0);
}