n!末尾有多少0 (数论)

n的阶乘的末尾有多少个0?


代码:

#include<iostream>
#include<cstdio>
#include<map>
#include<algorithm>
using namespace std;
 
map<string,int>m[1005];
 
int main(){
    int n;
    while(~scanf("%d",&n)){
        long long num = 0;
        while(n != 0)
        {
            num=num+n/5;
            n=n/5;
        }
        printf("%lld\n",num);
    }
    return 0;
} 


全部评论

相关推荐

饼子吃到撑:学院本是这样的,找工作拼运气,你技术再好人家筛选学历照样沉入海底,海投就行了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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