Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vector<int> array;
- for (int i = 0; i < n; ++i){
- cin >> array[i];
- }
- do {
- for(auto const& value: array) {
- cout << value << ' ';
- }
- cout << endl;
- } while(std::next_permutation(array.begin(), array.end()));
- vector<vector<int>> permutations;
- while(std::next_permutation(array.begin(), array.end())){
- permutations.push_back(next_permutation(array.begin(), array.end())));
- }
- int currentpath;
- for (int row = 0; row < n; ++row){
- for (int column = 0; column < n; ++column){
- for (int k = 0; k < permutations.size(); ++k){
- currentpath += permutations[row][column];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement