题解 | 阶乘尾零

阶乘尾零

https://www.nowcoder.com/practice/434922f9f4724b97b83c417e884008f1

#include <cmath>
class Factor {
public:
    int getFactorSuffixZero(int n) {
        // write code here
        int count = log(n)/log(5);
        int res =0;
        for (int i=1; i<=count; ++i) {
            res+= n/pow(5,i);
        }
        return res;
    }
};

全部评论

相关推荐

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

创作者周榜

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