Pagini recente » Monitorul de evaluare | Cod sursa (job #336892) | Istoria paginii utilizator/hunnyvalentina | Istoria paginii utilizator/irikos | Cod sursa (job #1723372)
#include <bits/stdc++.h>
using namespace std;
int a[30], n, cnt;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
void Afis()
{
int i;
cnt++;
if (cnt == 1) return;
for (i = 1; i <= n; ++i)
if (a[i] == 1) fout << i << " ";
fout << "\n";
}
void Gen(int top)
{
if (top == n + 1) Afis();
else
for (int i = 0; i <= 1; i++)
{
a[top] = i;
Gen(top + 1);
}
}
int main()
{
fin >> n;
Gen(1);
return 0;
}