Advertisement
OIQ

Untitled

OIQ
Mar 15th, 2020
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <set>
  5. #include <cmath>
  6. #include <map>
  7. #include <utility>
  8. #include <fstream>
  9. #include <bitset>
  10. typedef long long int ll;
  11. #define all(x) (x).begin(),(x).end()
  12. #define endl "\n";
  13. long double pi = 3.14159265358979;
  14. using namespace std;
  15. int inf = 1e9;
  16. ll MOD = 1e9+ 7;
  17.  
  18. void fastIO() {
  19.     ios_base::sync_with_stdio(false);
  20.     cin.tie(0);
  21.     cout.tie(0);
  22. }
  23.  
  24. int main() {
  25.     fastIO();
  26.     vector <int> a(6);
  27.     a[0] = 0;
  28.     a[1] = 1;
  29.     a[2] = 2;
  30.     a[3] = 3;
  31.     a[4] = 4;
  32.     a[5] = 5;
  33.  
  34.     while (next_permutation(all(a))) {
  35.         string s = "";
  36.         for (int i = 0; i < 6; i++)
  37.             s += (char)('a' + a[i]);
  38.         char c90;
  39.         char c200;
  40.         char c300;
  41.         char c1000;
  42.         for (int i = 1; i <= 1000; i++) {
  43.             char c1 = s[s.size() / 2 - 1];
  44.             char c2 = s[s.size() / 2];
  45.             string s1;
  46.             s1.push_back(c1);
  47.             s1.push_back(c2);
  48.             s1 += s;
  49.             s = s1;
  50.             if (i == 90)
  51.                 c90 = s[0];
  52.             if (i == 200)
  53.                 c200 = s[0];
  54.             if (i == 30)
  55.                 c300 = s[0];
  56.             if (i == 1000)
  57.                 c1000 = s[0];
  58.         }
  59.         if (c90 == 'd' && c200 == 'a' && c300 == 'c' && c1000 == 'b') {
  60.             for (int i = 0; i < 6; i++) cout << a[i] << " ";
  61.             break;
  62.         }
  63.     }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement