Pagini recente » Cod sursa (job #3244894) | Cod sursa (job #3289615) | Cod sursa (job #2401497) | Cod sursa (job #2463977) | Cod sursa (job #2365931)
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream fin("permutari.in");
ofstream fout("permutari.out");
unsigned int n;
vector<unsigned int> perm;
int main() {
fin >> n;
perm = vector<unsigned int>(n);
for (unsigned int i = 0; i < n; i++)
perm[i] = i + 1;
do {
for (unsigned int x : perm)
fout << x << " ";
fout << "\n";
} while (next_permutation(perm.begin(), perm.end()));
return 0;
}