Cod sursa(job #2169692)
Utilizator | Data | 14 martie 2018 16:41:41 | |
---|---|---|---|
Problema | Combinari | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include <fstream>
using namespace std;
ifstream fin("combinari.in");
ofstream fout("combinari.out");
int n,k,v[20];
void scrie() {
for (int i=1; i<=k; i++)
fout<<v[i]<<' ';
fout<<'\n';
}
void comb(int i) {
for (int j=v[i-1]+1; j<=n; j++) {
v[i]=j;
if (i==k) scrie();
else comb(i+1);
}
}
int main()
{
fin>>n>>k;
comb(1);
return 0;
}