首页 > 其他 > 详细

17.3---阶乘尾多少个0(CC150)

时间:2016-01-05 15:16:57      阅读:203      评论:0      收藏:0      [点我收藏+]

  思路,其实这题easy,就是看多少个5.

答案:

技术分享
    public static int getFactorSuffixZero(int n) {
        // write code here
        int res = 0;
        while(n != 0){
            res += n / 5;
            n = n / 5;
        }
        
        
        return res;
    }
View Code

 

17.3---阶乘尾多少个0(CC150)

原文:http://www.cnblogs.com/yueyebigdata/p/5102296.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!