영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
Problem
37A
+A50
----
131AIn the figure, an addition of two numbers is shown – but in which base are the numbers written, and in which base is the addition performed?
The task is to write a program that receives two terms and a sum in the form of three strings. The program should then determine in which bases the addition is correct.
The tests will cover the fifteen bases from 2 to 16. To represent the numbers 10, 11, 12, 13, 14, and 15, the capital letters A, B, C, D, E, and F are used. It can be assumed that there is always at least one base for which the addition is correct.
Input
The input consists of three strings, each with at most 10 characters, on three consecutive lines. The first two lines represent the terms of the addition, and the third line represents the sum. The numbers do not contain leading zeros.
Output
Print a number of integers: all bases for which the addition is correct. The bases should be listed in ascending order.
예제
예제 1
37A A50 131A
11
예제 2
A1 5 A6
11 12 13 14 15 16