Cod sursa(job #2581369)

Utilizator s.gabi7Dumitrescu Daniel s.gabi7 Data 15 martie 2020 00:50:25
Problema Generare de permutari Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.36 kb
#include <bits/stdc++.h>
using namespace std;

int main () {
    ifstream fin ("permutari.in");
    ofstream fout ("permutari.out");
    int n;
    fin >> n;
    vector <int> v(n);
    iota(v.begin(), v.end(), 1);
    do {
        for (auto it: v)
            fout << it << ' ';
        fout << '\n';
    } while (next_permutation(v.begin(), v.end()));
}