https://www.acmicpc.net/problem/11005
Code
from string import ascii_uppercase
ref = [str(x) for x in range(10)] + list(ascii_uppercase)
N, B = map(int, input().split())
result = ''
while (N > 0):
Q = N//B
R = ref[N-(Q*B)]
N = Q
result = R + result
print(result)