Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- a = input()
- k = int(input())
- chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- num = []
- a = int(a, n)
- while a != 0:
- num.append(chars[a % k])
- a = a // k
- num = "".join(num[::-1])
- if len(num) > 0:
- print(num)
- else:
- print(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement