base convert by croyal

while 1:
 s=raw_input().split()
 n=int(s[0])
 b=int(s[1])
 l=[]
 while n>=b:
  l+=[str(n%b)]
  n=n/b
 if n>0:l+=[str(n)]
 l.reverse()
 print''.join(l)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page