标签:ref try 实现 zh-cn return sdn 返回 sum article
题目:
样例:
11! = 39916800
,因此应该返回 2思路:
实现
Java实现代码
public class Solution {
/*
* @param n: An integer
* @return: An integer, denote the number of trailing zeros in n!
*/
public long trailingZeros(long n) {
// write your code here, try to do it without arithmetic operators.
long sum = 0;
while(n>0){
n=n/5;
sum=sum+n;
}
return sum;
}
}
标签:ref try 实现 zh-cn return sdn 返回 sum article
原文地址:https://www.cnblogs.com/hglibin/p/8979497.html