就是找一个数的阶乘后面有多少个零。
逻辑很有意思
原题:
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
AC后的代码:class Solution {
public:
int trailingZeroes(int n) {
int sum=0;
while(n>0)
{
sum+=n/5;
n/=5;
}
return sum;
}
};