判断n的阶乘里有多少个0:
class Solution {
public:
int trailingZeroes(int n)
{
int ans=0;
while(n)
{
n /= 5;
ans += n;
}
return ans;
}
};
判断n的阶乘里有多少个0:
class Solution {
public:
int trailingZeroes(int n)
{
int ans=0;
while(n)
{
n /= 5;
ans += n;
}
return ans;
}
};