Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
416 B
3
Indexable
Never
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