Cod sursa(job #2366009)

Utilizator qwerty1234qwerty qwerty1234 Data 4 martie 2019 18:00:28
Problema Generare de permutari Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.44 kb

#include <bits/stdc++.h>


using namespace std;

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

vector < int > L;

int n;

int main()
{
    fin >> n;
    for(int i = 1 ; i <= n ; i++)
        L.push_back(i);
    do
    {
        for(auto it : L)
            fout << it << " ";
        fout << "\n";
    }while (next_permutation(L.begin() , L.end()));
    fin.close();
    fout.close();
    return 0;
}