Cod sursa(job #2433075)
Utilizator | Data | 25 iunie 2019 19:25:17 | |
---|---|---|---|
Problema | Generare de permutari | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("permutari.in");
ofstream g("permutari.out");
int i,n;
vector<int> v;
int main()
{
f>>n;
for(i=1;i<=n;i++)
v.push_back(i);
while(next_permutation(v.begin(),v.end()))
{
for(i=0;i<n;++i)
g<<v[i]<< ' ';
g<<"\n";
}
return 0;
}