Cod sursa(job #2274967)

Utilizator OctavianVasileVasileOctavian OctavianVasile Data 2 noiembrie 2018 18:13:19
Problema Combinari Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.43 kb
#include<bits/stdc++.h>
using namespace std;
ifstream fin ("combinari.in");
ofstream fout ("combinari.");
int n, v [200], k;
void print (){
    for (int i = 1; i <= n; i ++)fout << v [i] << " ";
    fout << '\n';
}
void func (int poz){
    if (poz == n + 1)print ();
    for (int i = v [poz - 1] + 1; i <= k; i ++){
            v [poz] = i;
            func (poz + 1);
    }
}
int main (){
	fin >> k >> n;
	func (1);
}