Skip to content

Commit 71a7f0c

Browse files
committed
93차 2번 문제풀이
1 parent 47804c7 commit 71a7f0c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

live9/test93/문제2/백유진.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
def solution(name):
22
answer = 0
33

4+
min_cursor = len(name) - 1
45

56
for idx, alphabet in enumerate(name):
67
answer += min(ord(alphabet) - 65, 91 - ord(alphabet))
7-
print(ord(alphabet) - 65)
8-
print(91 - ord(alphabet))
98

109
end = idx+1
1110
while end < len(name) and name[end] == 'A':
1211
end += 1
13-
print(idx+1, end)
12+
min_cursor = min(min_cursor, idx*2 + len(name)-end, (len(name)-end)*2 + idx)
1413

15-
answer += min(end-(idx+1), )
16-
14+
answer += min_cursor
15+
1716
return answer

0 commit comments

Comments
 (0)