题目:
给定数字n,返回n!对应数字中的末尾0的个数。
解题思路:
判断末尾0的个数,直接查看之前的数字里头包含5的个数或5的倍数的个数,数字5,包含一个5,数字10包含两个(5,10),15包含三个(5,10,15)。。。25包含六个(5,10,15,20,5*5)
代码(Python):
class Solution(object):
def trailingZeroes(self, n):
"""
:type n: int
:rtype: int
"""
count = 0
while(n):
count = count+n/5
n = n/5
return count