Pagini recente » Cod sursa (job #426442) | Cod sursa (job #1180767) | Cod sursa (job #2214884) | Cod sursa (job #937650) | Cod sursa (job #3239885)
#include <bits/stdc++.h>
using namespace std;
std::string file = "permutari";
std::ifstream fin(file + ".in");
std::ofstream fout(file + ".out");
// #define fin std::cin
// #define fout std::cout
int32_t main(int32_t argc, char *argv[]) {
ios_base::sync_with_stdio(false);
fin.tie(0);
fout.tie(0);
int n;
fin >> n;
std::vector<int> perm;
for (int i = 0; i < n; ++i)
perm.push_back(i + 1);
do {
for (int i = 0; i < n; ++i)
fout << perm[i] << " ";
fout << "\n";
} while (next_permutation(perm.begin(), perm.end()));
return 0;
}