https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWjlH0k63joDFAVT
숫자에 대해 앞에 있는 두 개를 합치든, 가운데에 있는 두 개를 합치든 결국 결과는 같다는 걸 발견했고, 따라서 숫자를 문자로 받은 뒤 앞에 있는 두 글자를 int로 변환하여 합치는 과정을 카운트 한 뒤 홀짝 여부에 따라 알맞는 승자를 리턴해주도록 했다.
def game(num):
cnt = 0
while len(num) > 1:
num = str(int(num[0]) + int(num[1])) + num[2:]
cnt += 1
if cnt % 2:
return 'A'
else:
return 'B'
T = int(input())
for tc in range(1, T+1):
number = input()
print('#{} {}'.format(tc, game(number)))