Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <string>
  3. #include <algorithm>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     freopen ("input.txt", "r", stdin);
  11.     freopen ("output.txt", "w", stdout);
  12.     system("color 0B");
  13.     setlocale(LC_ALL, "rus");
  14.     int n;
  15.     cin >> n;
  16.     string g;
  17.     vector <string> v;
  18.     for (int i = 0; i < n; i++)
  19.     {
  20.         cin >> g;
  21.         v.push_back(g);
  22.     }
  23.     sort(v.begin(), v.end());
  24.     int j = 1;
  25.     for (int i = n; i > 1; i--)
  26.     {
  27.         j *= i;
  28.     }
  29.     cout << j << endl;
  30.     do
  31.     {
  32.         for (int i = 0; i < v.size(); i++)
  33.             cout << v[i] << " ";
  34.         cout << endl;
  35.     }
  36.     while(next_permutation(v.begin(), v.end()));
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement