Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- def power2(num):
- counter = 0
- while num > 1:
- counter += 1
- num = num // 2
- return counter
- N = int(input())
- first = int(input())
- second = int(input())
- if first < second:
- second, first = first, second
- diff = power2(first) - power2(second)
- if diff > 0:
- for i in range(diff):
- first = first // 2
- while True:
- if first == second:
- print(first)
- sys.exit()
- first = first // 2
- second = second // 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement