#t100. 进制转换
进制转换
Base Conversion (Decimal to R-ary)
Problem Description
Xiaomei just learned hexadecimal and found it interesting. She wonders if there are even larger bases. In hexadecimal, A represents and F represents . If we extend it so that Z represents , can't we represent base- numbers?
So you need to help her write a program that converts a decimal number to base ().
Input Format
Two lines of input. The first line contains a positive integer . The second line contains a positive integer . It is guaranteed that .
Output Format
One line: the base- representation of .
Sample Input
123
25
Sample Output
4N
Sample Explanation
The process of converting the decimal number to base is as follows:
- divided by gives quotient and remainder .
- The remainder maps to the character
Nunder the extended rule (Ais , and so on,Nis ). - The quotient is kept as is, since .
- Concatenate the results from the last quotient to the first remainder, giving
4N.
So the output is 4N.
Constraints
For all data, , .