给定一个整数 n,返回 n! 结果尾数中零的数量。
注意: 你的解决方案应为对数时间复杂度。
详见:https://leetcode.com/problems/factorial-trailing-zeroes/description/
class Solution {
public:
int trailingZeroes(int n) {
int res=0;
while(n)
{
n/=5;
res+=n;
}
return res;
}
};
参考:https://www.cnblogs.com/grandyang/p/4219878.html