#B3619. Decimal to Base Conversion
Decimal to Base Conversion
Decimal to Base Conversion
Given a decimal integer \(n\) and a small integer \(x\), convert the integer \(n\) to its base \(x\) representation. For digits greater than 9, use uppercase letters: A, B, C, and so on. For instance, converting \(31\) to base \(16\) should yield "1F".
Note: The conversion should follow the standard algorithm of repeatedly dividing by the base \(x\) and taking the remainder, which represents the digits in reverse order.
inputFormat
The input consists of two numbers separated by a space: a decimal integer \(n\) and an integer \(x\) that represents the target base.
Constraints: \(0 \leq n \leq 10^{18}\) and \(2 \leq x \leq 36\).
outputFormat
Output the base \(x\) representation of \(n\) using digits 0-9 and uppercase letters A-Z for values 10 to 35. Do not include any leading zeros.
sample
15 2
1111