Advertisement
Mr_ChAI

Untitled

Apr 25th, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. a, b, c = '='.join(input().split('+')).split('=')
  2. for i in range(2, 37):
  3. try:
  4. a1, b1, c1 = int(a, i), int(b, i), int(c, i)
  5. except ValueError:
  6. continue
  7. else:
  8. if a1 + b1 == c1:
  9. print(i)
  10. break
  11. else:
  12. print(-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement