#P2084. 进制转换
进制转换
Description
Today, Xiao Ming learned base conversion. For example, for , its decimal representation as an expression is:
$$1\times 2^4+0\times 2^3+1\times 2^2+0\times 2^1+1\times 2^0$$Please write a program that converts a number in base into its decimal representation as an expression.
Note: When a coefficient is , that term should be omitted.
Input Format
Two integers, and , separated by a space.
Output Format
One line: the decimal representation as an expression.
2 10101
1*2^4+1*2^2+1*2^0
Hint
For of the testdata, , the number of digits of does not exceed , and each digit is an integer in .
Translated by ChatGPT 5
京公网安备 11011102002149号