Cod sursa(job #2913047)
| Utilizator | Data | 12 iulie 2022 12:44:39 | |
|---|---|---|---|
| Problema | Submultimi | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include <stdio.h>
#include <stdlib.h>
int n, sol[10];
void print(int k)
{
for(int i = 1; i <= k; i++)
{
printf("%d ", sol[i]);
}
printf("\n");
}
void Back(int pas)
{
if(pas > 1)
{
print(pas - 1);
}
if(pas == n + 1)
{
return;
}
for(int i = sol[pas - 1] + 1; i <= n; i++)
{
sol[pas] = i;
Back(pas + 1);
}
}
int main()
{
scanf("%d", &n);
Back(1);
return 0;
}
