#P1604. B进制星球
B进制星球
Description
One day, Xiao Z traveled by spaceship to a beautiful planet. For historical reasons, technology on this beautiful planet is not very advanced, and people commonly use base for counting. The locals treated Xiao Z with delicious food; as a return, Xiao Z wants to give them a calculator that can perform base addition. Now Xiao Z hopes you can help him by writing a program that performs base addition.
Input Format
The testdata consists of three lines.
The first line contains a decimal integer representing the base .
The second and third lines each contain a positive integer in base . Each digit belongs to .
Output Format
A base number representing the sum of the two input numbers.
4
123
321
1110
Hint
Constraints
Let denote the lengths of the two base numbers.
For all testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号