~/algor $ cat problems/while-k-lik-sanoq-sistemasi
Conversion to base k
Medium
1000 ms
64 MB
48%
Two integers $n$ and $k$ are given. Find the notation of $n$ in the base-$k$ numeral system (for example, $10 = 1 * 3^{2} + 0 * 3^{1} + 1 * 3^{0} = 101_{3}$).
Input
One line with two integers: $n$ and $k$.
Output
The base-$k$ notation of $n$ — no spaces between digits and no extra leading zeros; if $n = 0$, print 0.
Note
$0 \le n \le 10^{9}$
$2 \le k \le 9$
Examples
Input #1
10 3
Output #1
101
Input #2
255 2
Output #2
11111111