Cod sursa(job #1892938)
Utilizator | Data | 25 februarie 2017 13:24:00 | |
---|---|---|---|
Problema | Combinari | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
bool sol[10];
int st[10];
unsigned long long int nr1,nr,n,m;
ifstream in("combinari.in");
ofstream out("combinari.out");
void afis()
{
for(int i=1;i<=m;i++)
out<<st[i]<<" ";
out<<'\n';
}
void backt(int k)
{
if(k==m+1)
afis();
else
for(st[k]=st[k-1]+1;st[k]<=n;st[k]++)
backt(k+1);
}
int main()
{
in>>n>>m;
backt(1);
}