Cod sursa(job #2697776)
Utilizator | Data | 19 ianuarie 2021 16:25:32 | |
---|---|---|---|
Problema | Submultimi | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.46 kb |
#include <fstream>
using namespace std;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
int f[17],n,sol;
void backt(int k) {
int j;
if(k==n+1) {
for(int i=1;i<=n;i++)
if(f[i]==1)
fout<<i<<" ";
fout<<'\n';
}
else {
f[k]=0;
backt(k+1);
f[k]=1;
backt(k+1);
}
}
int main()
{
fin>>n;
backt(1);
fout<<'\n';
return 0;
}