21 lines
565 B
Python
21 lines
565 B
Python
import math
|
|
|
|
|
|
def calculate_distance(aphorism: str) -> int:
|
|
tokens = "ABCDEFGHIJKLMNOPQRSTUVWXYZ '"
|
|
prev_s = aphorism[0]
|
|
total_distance = 0
|
|
for s in aphorism:
|
|
current_distance = (tokens.index(prev_s) - tokens.index(s)) % 28
|
|
if current_distance > 14:
|
|
current_distance = 28 - current_distance
|
|
prev_s = s
|
|
total_distance += current_distance
|
|
return 60 * math.pi / 28 * total_distance
|
|
|
|
|
|
n = int(input())
|
|
for _ in range(n):
|
|
aphorism = input()
|
|
print(calculate_distance(aphorism) / 15 + len(aphorism))
|