Cod sursa(job #1237987)
| Utilizator | Data | 5 octombrie 2014 13:34:18 | |
|---|---|---|---|
| Problema | Dezastru | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.61 kb |
#include <stdio.h>
using namespace std;
int x[100],n,m,use[100];
void afis()
{
int i;
for(i=1;i<=m;i++)
printf("%d ",x[i]);
printf("\n");
}
void back(int k)
{
int i;
if(k>m)afis();
else
for(i=k;i<=n;i++)
if(i>x[k-1])
{
x[k]=i;
back(k+1);
}
}
int main()
{
freopen("combinari.in","r",stdin);
freopen("combinari.out","w",stdout);
scanf("%d%d",&n,&m);
back(1);
return 0;
}
//Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time.
