Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. vector<int> array;
  2. for (int i = 0; i < n; ++i){
  3. cin >> array[i];
  4. }
  5. do {
  6. for(auto const& value: array) {
  7. cout << value << ' ';
  8. }
  9. cout << endl;
  10. } while(std::next_permutation(array.begin(), array.end()));
  11. vector<vector<int>> permutations;
  12. while(std::next_permutation(array.begin(), array.end())){
  13. permutations.push_back(next_permutation(array.begin(), array.end())));
  14. }
  15. int currentpath;
  16.  
  17. for (int row = 0; row < n; ++row){
  18. for (int column = 0; column < n; ++column){
  19. for (int k = 0; k < permutations.size(); ++k){
  20. currentpath += permutations[row][column];
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement