Advertisement
Josif_tepe

Untitled

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