You are viewing a single comment's thread. Return to all comments →
Using Binary Search:
def solve(n): def count(x): res = 0 while x: t = x//5 res+=t x = t return res
l,r = 5,5*(10**16) res = 5 while l<=r: mid = (l+r)//2 if count(mid)>=n: res = mid r = mid - 1 else: l = mid + 1 return res
Seems like cookies are disabled on this browser, please enable them to open this website
Manasa and Factorials
You are viewing a single comment's thread. Return to all comments →
Using Binary Search:
def solve(n): def count(x): res = 0 while x: t = x//5 res+=t x = t return res