Pagini recente » Cod sursa (job #522456) | Profil catazep | Cod sursa (job #71268) | Cod sursa (job #1068537) | Cod sursa (job #2474025)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
int a[20], n, cnt;
void Afisare(int n)
{
cnt++;
if (cnt == 1) return ;
for (int i = 1; i <= n; i++)
if (a[i] == 1)
fout << i << " ";
fout << "\n";
}
void Back(int top)
{
if (top == n + 1) Afisare(n);
else for (int i = 0; i <= 1; i++)
{
a[top] = i;
Back(top + 1);
}
}
int main()
{
fin >> n;
Back(1);
return 0;
}