每日一题力扣172

给定一个整数 n,返回 n! 结果尾数中零的数量。

 

 

包含5的就可以,因为出现5就意味着肯定有2,

class Solution:
    def trailingZeroes(self, n: int) -> int:
        count=0
        while n>=5:
            count+=n//5
            n/=5
        return int(count)

 

posted @ 2021-03-10 17:15  小千北同学超爱写代码  阅读(35)  评论(0编辑  收藏  举报