Cod sursa(job #1976943)

Utilizator blatulInstitutul de Arta Gastronomica blatul Data 4 mai 2017 16:54:00
Problema Generare de permutari Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.4 kb
#include <bits/stdc++.h>
using namespace std;

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

int main() {

    int N;

    fin >> N;

    vector<int> perm(N);

    iota(perm.begin(), perm.end(), 1);

    do {
        for (auto& val: perm)
            fout << val << " ";
        fout << "\n";

    }while(next_permutation(perm.begin(), perm.end()));

    return 0;
}