题解 | #阶乘末尾0的数量#
阶乘末尾0的数量
http://www.nowcoder.com/practice/aa03dff18376454c9d2e359163bf44b8
import java.util.*;
public class Solution { /** * the number of 0 * @param n long长整型 the number * @return long长整型 */ public long thenumberof0 (long n) { // write code here long sum = 0; long temp = 5; while(n / temp >= 1 ){ sum += n / temp; temp *= 5; } return sum; } }
我居南半坡 文章被收录于专栏
多刷题,积蓄力量,欢迎讨论