Cod sursa(job #959700)
| Utilizator | Data | 8 iunie 2013 15:16:39 | |
|---|---|---|---|
| Problema | Submultimi | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include <fstream>
#define DIM 20
using namespace std;
int v[DIM];
int n, i, ok;
int main() {
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
fin>>n;
while (v[0] == 0) {
i = n;
while (v[i] == 1) {
v[i] = 0;
i--;
}
v[i] = 1;
ok = 1;
for (i=1;i<=n;i++)
if (v[i] == 1) {
fout<<i<<" ";
ok = 0;
}
if (ok == 0)
fout<<"\n";
}
return 0;
}
