Skip to content

Commit a09ccab

Browse files
committed
[BOJ] 이름 궁합 테스트/ 실버 5 / 35분
https://www.acmicpc.net/problem/17269
1 parent 67bbef6 commit a09ccab

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import copy
2+
dic = {'A':3,'B':2,'C':1,'D':2,'E':4,'F':3,'G':1,'H':3,'I':1,'J':1,'K':3,'L':1,'M':3,'N':2,'O':1,'P':2,'Q':2,'R':2,'S':1,'T':2,'U':1,'V':1,'W':1,'X':2,'Y':2,'Z':1}
3+
N, M = map(int, input().split())
4+
A, B = input().split()
5+
6+
min_len = min(N,M)
7+
new = []
8+
for i in range(min_len):
9+
new += A[i] + B[i]
10+
11+
if N > M:
12+
new += A[min_len:]
13+
elif N < M:
14+
new += B[min_len:]
15+
16+
new_num = []
17+
for j in new:
18+
new_num.append(dic[j])
19+
20+
while len(new_num) > 2:
21+
temp = []
22+
for k in range(1, len(new_num)):
23+
temp_num = new_num[k-1] + new_num[k]
24+
if temp_num >= 10:
25+
temp_num -= 10
26+
temp.append(temp_num)
27+
new_num = copy.deepcopy(temp)
28+
29+
print("{}%".format(new_num[0]*10 + new_num[1]))

0 commit comments

Comments
 (0)