dddd

来源:互联网 发布:淘宝卖品牌要授权吗 编辑:程序博客网 时间:2024/05/29 16:43

/**
 * 第二题的解法
 *
 * @author LvGuoFei
 * @version 创建时间:2016-9-18 下午11:37:54
 * @version <h3>This class of code that there will be no mistake, amen</h3>
 */
public class Reply {
    /**
     * 统计阶乘数据中出现零的个数
     *
     * @param i
     * @return
     * @author LvGuoFei
     */
    private static int zeroNum(int i) {
        int zn = i / 5;
        int aa = cs(zn);
        aaj = 0;
        zn = zn + aa;
        return zn;
    }

    private static int aaj = 0;

    private static int cs(int i) {
        int j = i / 5;
        if (j >= 5) {
            aaj += j;
            cs(j);
        } else {
            aaj += j;
        }
        return aaj;
    }

    public static void main(String[] args) {
        System.out.println(zeroNum(1259));
    }

}
0 0
原创粉丝点击