Number system
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
You are given a number ( A ) and a base ( P ) for a numeral system, both expressed in decimal form. Your task is to convert the number ( A ) into its representation in the base ( P ) numeral system.
Input Data
The first line contains the decimal representation of the number ( A ), which can be up to 1000 characters long. The second line contains the decimal representation of the base ( P ), also up to 1000 characters long.
Output Data
Provide the representation of the number ( A ) in the base ( P ) numeral system. If a digit in this system is between 0 and 9, print the digit directly. If the digit is greater than 9, enclose its decimal representation in square brackets (as shown in the example).
Examples
Input #1
Answer #1
Submissions 702
Acceptance rate 36%