# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # the number of 0 # @param n long长整型 the number # @return long长整型 # class Solution: def thenumberof0(self , n: int) -> int: # write code here result = 0 i = 5 while n >=i: result += n // i i *= 5 return result
def thenumberof0(self , n ): # write code here if n < 5: return 0 res = 0 k = int(math.log(n, 5)) cur = 5 for i in range(k): res += n // cur cur *= 5 return res