Cod sursa(job #2779707)
Utilizator | Data | 4 octombrie 2021 19:18:43 | |
---|---|---|---|
Problema | Generare de permutari | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.47 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("permutari.in");
ofstream g("permutari.out");
#define cin f
#define cout g
const int Max = 5e5 + 1;
void nos()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int n;
int32_t main()
{
int n;
f>>n;
int i;
std::vector< int > v;
for(i=1;i<=n;i++)
v.push_back(i);
do{
for(auto it : v)
cout<<it<<' ';
cout<<'\n';
}while(next_permutation(v.begin(), v.end()));
return 0;
}