Cod sursa(job #972411)
Utilizator | Data | 11 iulie 2013 17:19:42 | |
---|---|---|---|
Problema | Submultimi | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.55 kb |
#include <fstream>
using namespace std;
int a[16];
int main()
{
int n,i,ok;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
fin>>n;
while (a[0] == 0)
{
i = n;
while (a[i] == 1)
{
a[i] = 0;
i--;
}
a[i] = 1;
ok = 1;
for (i=1;i<=n;i++)
if (a[i] == 1)
{
fout<<i<<" ";
ok = 0;
}
if (ok == 0)
fout<<"\n";
}
return 0;
}