Pagini recente » Cod sursa (job #670811) | Cod sursa (job #2919177) | Cod sursa (job #578256) | Cod sursa (job #759669) | Cod sursa (job #2751509)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
int st[20], n;
/**
*/
void Afis(int n)
{
if (n == 0) return;
for (int i = 1; i <= n; i++)
fout << st[i] << " ";
fout << "\n";
}
void Subm(int top)
{
Afis(top-1);
if (st[top-1] < n)
{
for (int i = st[top-1]+1; i <= n; i++)
{
st[top] = i;
Subm(top + 1);
}
}
}
int main()
{
fin >> n;
Subm(1);
fout.close();
return 0;
}