Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number.
Now for any pair of positive integers N1 and N2, your task is to find the radix of one number while that of the other is given.
Input Specification:
Each input file contains one test case. Each case occupies a line which contains 4 positive integers:
N1 N2 tag radix
Here N1 and N2 each has no more than 10 digits. A digit is less than its radix and is chosen from the set { 0-9, a-z } where 0-9 represent the decimal numbers 0-9, and a-z represent the decimal numbers 10-35. The last number radix is the radix of N1 if tag is 1, or of N2 if tag is 2.

该问题要求根据给定的两个正整数和一个基数,找出另一个数的基数,使得两者等价。输入包括四个正整数,分别表示两个数和已知基数。输出是未知基数,若无解则输出'IMPOSSIBLE',不唯一则输出最小可能的基数。
最低0.47元/天 解锁文章
&spm=1001.2101.3001.5002&articleId=95869269&d=1&t=3&u=6b26f7deffd9490185e4a4572f1de9d8)
571

被折叠的 条评论
为什么被折叠?



