Untitled
unknown
python
4 years ago
416 B
8
Indexable
try:
while True:
num,n=input().split( )
num=int(num)
n=int(n)
ary=[]
tmp=num
ans=""
while(tmp>0):
if(0<=tmp%n<=9):
ans+=chr(tmp%n+ord('0'))
elif(10<=tmp%n<=35):
ans+=chr(ord('a') +tmp%n-10)
else:
ans+=chr(ord('A') +tmp%n-36)
tmp=int(tmp/n)
if(num==0):
print("0")
else:
print(ans[::-1])
except EOFError:
pass
Editor is loading...