xT30x

Untitled

Dec 11th, 2022
697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.29 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. using ll = long long;
  5. using ld = long double;
  6.  
  7. string ltr(26, 'A');
  8. vector<string> als;
  9.  
  10. void solve(string x, string ax, ll i)
  11. {
  12.     if (x.size() == ax.size())
  13.     {
  14.         als.push_back(ax);
  15.         return;
  16.     }
  17.     if (x.at(i) == '_')
  18.     {
  19.  
  20.         solve(x, ax + 'C', i + 1);
  21.         solve(x, ax + 'V', i + 1);
  22.         solve(x, ax + 'L', i + 1);
  23.     }
  24.     else
  25.     {
  26.         solve(x, ax + x.at(i), i + 1);
  27.     }
  28. }
  29. int main()
  30. {
  31.     ll fs = 0;
  32.     string x;
  33.     cin >> x;
  34.     string vcl{"AEIOU"};
  35.     vector<ll> ex(x.size());
  36.     ll i = 0;
  37.     for (auto &cl : x)
  38.     {
  39.         if (cl != '_' && cl != 'L')
  40.         {
  41.             if (vcl.find(cl) != string::npos)
  42.             {
  43.                 cl = 'V';
  44.             }
  45.             else
  46.             {
  47.                 cl = 'C';
  48.             }
  49.         }
  50.         else
  51.         {
  52.             if (cl != 'L')
  53.             {
  54.                 ex.at(i) = 1;
  55.             }
  56.         }
  57.         i += 1;
  58.     }
  59.     string ax;
  60.     solve(x, ax, 0);
  61.     for (auto cl : als)
  62.     {
  63.         bool r1 = true, r2 = true;
  64.         ll c = 0;
  65.         ll v = 0;
  66.         for (auto c1 : cl)
  67.         {
  68.  
  69.             if (c1 == 'V')
  70.             {
  71.                 v += 1;
  72.                 c = 0;
  73.             }
  74.             else
  75.             {
  76.                 v = 0;
  77.                 c += 1;
  78.             }
  79.             if (c == 3 || v == 3)
  80.             {
  81.                 r1 = false;
  82.                 break;
  83.             }
  84.         }
  85.         if (cl.find('L') == string::npos)
  86.         {
  87.             r2 = false;
  88.         }
  89.         if (r1 && r2)
  90.         {
  91.             ll as = 1;
  92.             ll i = 0;
  93.             for (auto c1 : cl)
  94.             {
  95.                 if (ex.at(i) == 1)
  96.                 {
  97.                     if (c1 == 'V')
  98.                     {
  99.                         as = as * 5;
  100.                     }
  101.                     else if (c1 == 'C')
  102.                     {
  103.                         as = as * 20;
  104.                     }
  105.                     else if (c1 == 'L')
  106.                     {
  107.                         as *= 1;
  108.                     }
  109.                 }
  110.                 i += 1;
  111.             }
  112.             fs += as;
  113.         }
  114.     }
  115.  
  116.     cout << fs << endl;
  117.     return 0;
  118. }
Advertisement
Add Comment
Please, Sign In to add comment