#P1143. 进制转换

进制转换

Description

Write a program to convert a number between two different bases.

Input Format

There are three lines. The first line is a positive integer denoting the base of the given number, n (2n16)n\ (2\le n\le 16). The second line is a base-nn number; if n>10n>10, use uppercase letters AF\verb!A!\sim \verb!F! for digits 101510\sim 15, and the decimal value of this base-nn number does not exceed 10910^9. The third line is also a positive integer denoting the target base, m (2m16)m\ (2\le m\le 16).

Output Format

A single positive integer, which is the number in base mm after conversion.

16
FF
2

11111111

Hint

Translated by ChatGPT 5