T3000

Untitled

Oct 7th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 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. int main()
  8. {
  9.     string al(26, 'a');
  10.     iota(al.begin(), al.end(), 65);
  11.     al += " '";
  12.     ld dp = 60.0 * M_PI / 28;
  13.     ll n;
  14.     cin >> n;
  15.     cin.ignore();
  16.     while (n-- > 0)
  17.     {
  18.         string x;
  19.         ld sum = 0;
  20.         getline(cin, x);
  21.         ll p = al.find(x.at(0));
  22.         ll ps;
  23.         for (int i = 1; i < x.size(); i++)
  24.         {
  25.             ps = al.find(x.at(i));
  26.             sum += dp * min(abs(p - ps), 28 - abs(p - ps)) / 15.0;
  27.             sum++;
  28.             p = ps;
  29.         }
  30.         cout << sum << endl;
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment