题解 | #阶乘末尾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; } }

我居南半坡 文章被收录于专栏

多刷题,积蓄力量,欢迎讨论

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务