Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- ar = []
- for i in range(n):
- x = int(input())
- ar.append(x)
- def get(i2, i3, i5):
- return 2**i2 * 3**i3 * 5**i5
- import math
- def f(A):
- bst = 10**20
- for i5 in range(28):
- for i3 in range(40):
- rest = A // (5**i5 * 3**i3)
- if rest < 1:
- bst = min(bst, 5**i5 * 3**i3)
- continue
- i2 = int(math.log2(rest))
- res = get(i2, i3, i5)
- if res < A:
- res *= 2
- bst = min(bst, res)
- return bst
- for i in ar:
- print(f(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement