Advertisement
Josif_tepe

Untitled

Feb 28th, 2022
1,053
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main() {
  7.     int n;
  8.     cin >> n;
  9.     vector<int> v(n);
  10.     for(int i = 0; i < n; i++) {
  11.         cin >> v[i];
  12.     }
  13.    
  14.     sort(v.begin(), v.end());
  15.     do {
  16.         for(int i = 0; i < n; i++) {
  17.             cout <<v[i] << " ";
  18.         }
  19.         cout << endl;
  20.     } while(next_permutation(v.begin(), v.end()));
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement