Cod sursa(job #3182632)

Utilizator charlie1983Iscru Daria charlie1983 Data 9 decembrie 2023 11:10:11
Problema Submultimi Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
vector <int> stiva;
void bkt(int pas, int n){
    if(pas>n){
        if(stiva.empty()){
            return;
        }
        for(int i=0;i<stiva.size();i++){
            fout<<stiva[i]<<' ';

        }
        fout<<'\n';
        return;
    }
    bkt(pas+1,n);
    stiva.push_back(pas);
    bkt(pas+1,n);
    stiva.pop_back();
}

int main()
{
    int n;
    fin>>n;
    bkt(1,n);
    return 0;
}