Cod sursa(job #2587187)

Utilizator k2e0e0w3qDumitrescu Gheorghe k2e0e0w3q Data 22 martie 2020 13:40:23
Problema Generare de permutari Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.4 kb
#include <bits/stdc++.h>
using namespace std;

int main () {
    ifstream fin ("permutari.in");
    ofstream fout ("permutari.out");
    vector <int> t;

    int n;
    fin >> n;
    t.assign(n, 0);
    iota(t.begin(), t.end(), 1);
    do {
        for (auto it: t)
            fout << it << ' ';
        fout << '\n';
    } while (next_permutation(t.begin(), t.end()));
    return 0;
}