Cod sursa(job #663676)
| Utilizator | Data | 18 ianuarie 2012 20:23:17 | |
|---|---|---|---|
| Problema | Combinari | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include<fstream>
using namespace std;
const char InFile[] = "combinari.in";
const char OutFile[] = "combinari.out";
const int MaxN = 19;
int N,K,x[MaxN];
void back( int k )
{
if( k )
{
x[k] = x[k-1];
while( k <= K && x[k] < N )
{
x[k]++;
if( k == K )
{
for(int i = 1 ; i <= K ; i++ )
fout << x[i] << ' ';
fout << '\n';
}
else
back(k+1);
}
}
}
int main()
{
ifstream fin( InFile );
ofstream fout( OutFile );
fin >> N >> K;
back(1);
return 0;
}
