O_Egor

algo 41(1 балл) !!!(next_permutation)

Jan 9th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. #include <vector>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <cmath>
  5. #include <string>
  6. #include <set>
  7. #include <map>
  8. #include <iomanip>
  9. #include <time.h>
  10. #include <stdlib.h>
  11. using namespace std;
  12.  
  13. #define re return
  14. #define pb push_back
  15. #define eb emplace_back
  16. #define all(x) (x).begin(), (x).end()
  17. #define fi first
  18. #define se second
  19. #define sqrt(x) sqrt(abs(x))
  20. #define pi (3.14159265358979323846264338327950288419716939937510)
  21. #define unique(v) v.resize(unique(all(v)) - v.begin())
  22. #define bipbup ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
  23.  
  24. typedef vector<int> vi;
  25. typedef vector<vi> vvi;
  26. typedef pair<int, int> ii;
  27. typedef vector<ii> vii;
  28. typedef vector<string> vs;
  29. typedef double D;
  30. typedef long double ld;
  31. typedef long long ll;
  32. typedef pair<ll, ll> pll;
  33. typedef vector<ll> vll;
  34. typedef unsigned long long ull;
  35.  
  36. int main()
  37. {
  38.     vector<char> word;
  39.  
  40.     char c;
  41.     while (cin >> c)
  42.         word.push_back(c);
  43.  
  44.     sort(all(word));
  45.  
  46.     do
  47.     {
  48.         for (int i = 0; i < word.size(); i++)
  49.             cout << word[i];
  50.         cout << '\n';
  51.     } while (next_permutation(word.begin(), word.end()));
  52.     re 0;
  53. }
Add Comment
Please, Sign In to add comment