import math
def translate(num, base_num):
if num < base_num:
return str(num)
else:
n = int(math.log10(num) / math.log10(base_num)) + 1
trans_num = ''
for i in range(n):
num_add = num / (base_num ** (n - i - 1))
trans_num = trans_num + str(num_add)
num = num - num_add * (base_num ** (n - i - 1))
return trans_num
if __name__ == '__main__':
data = raw_input().split()
M, N = int(data[0]), int(data[1])
print translate(M, N)
原文链接:https://blog.csdn.net/C_Donald/article/details/77253176blog.csdn.net
本文为博主chimuuu原创文章,遵循 CC 4.0 BY-SA 版权协议