Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. n = int(input())
  2. a = input()
  3. k = int(input())
  4. chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  5. num = []
  6. a = int(a, n)
  7. while a != 0:
  8.     num.append(chars[a % k])
  9.     a = a // k
  10. num = "".join(num[::-1])
  11. if len(num) > 0:
  12.     print(num)
  13. else:
  14.     print(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement