본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 17202번 핸드폰 번호 궁합

by 현장 2021. 12. 8.

-코드

s = input()
s2 = input()
couple = []
for i in range(len(s)):
    couple.append(int(s[i]))
    couple.append(int(s2[i]))
while 1:
    dp = []
    if len(couple) == 2:
        break
    for i in range(len(couple) - 1):
        num = couple[i] + couple[i + 1]
        if num >= 10:
            num -= 10
        dp.append(num)
    couple = dp
print(f'{couple[0]}{couple[1]}')