LeetCode-127

Links:https://leetcode.com/problems/factorial-trailing-zeroes/

Given an integer n, return the number of trailing zeroes in n!.

Note: Your solution should be in logarithmic time complexity.

 

题目大意:求n!的末尾有多少个0…

思路:计算n!的质因数中5的个数。

因为:10 = 2*5(即只有一对2和5的时候才进位,又2比5个数多…)

 

【LeetCode】172. Factorial Trailing Zeroes
Tagged on:
0 0 投票数
Article Rating
订阅评论
提醒

0 评论
内联反馈
查看所有评论