Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tc = int(input())
- d9 = 10**9
- d18 = d9 * d9
- for _ in range(tc):
- n = int(input())
- ans = -1
- dif = 10**30
- i = 0
- while (True):
- t = n + i * d9
- t *= t
- k = t // d18
- p = k * d18
- if (k > d9):
- break
- k += 1
- p = k * d18
- if (k > 0) and (k <= d9) and (dif > abs(t - p)):
- dif = abs(t - p)
- ans = k
- i += 1
- print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement