#P1555. [USACO11NOV] 尴尬的数字 Awkward Digits B
[USACO11NOV] 尴尬的数字 Awkward Digits B
Description
Every time Bessie converts a number to a new base, she always writes exactly one digit incorrectly. For example, when she converts 14 to base , the correct result is 1110, but she might write 0110 or 1111. Bessie never accidentally inserts or deletes digits, so she might write an incorrect number that starts with 0.
Given Bessie's base form of and base form of after her conversion, compute the correct value of (in decimal). may be as large as , and the input guarantees that the solution exists and is unique.
Input Format
The first line contains the base representation of (with exactly one incorrect digit). The second line contains the base representation of (with exactly one incorrect digit).
Output Format
Output a single line with the correct value of .
1010
212
14
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号