• + 0 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