Cod sursa(job #2683111)

Utilizator andrei.florea0405Florea Andrei-Bogdan andrei.florea0405 Data 10 decembrie 2020 15:15:57
Problema Submultimi Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.68 kb
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

ifstream fin("submultimi.in");
ofstream fout("submultimi.out");


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    fin >> n;

    for (int i = 1; i < (1 << n); i++) {
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) {
                fout << j + 1 << " ";
            }
        }
        fout << "\n";
    }
    
    return 0;
}