码迷,mamicode.com
首页 > 其他好文 > 详细

5050 [JL] 他爱上了鸭蛋

时间:2016-10-06 20:07:40      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

5050 [JL] 他爱上了鸭蛋

 

 时间限制: 1 s
 空间限制: 1000 KB
 题目等级 : 白银 Silver
 
 
 
题目描述 Description

小明爱上了零鸭蛋。他喜欢输入一个数,求这个数阶乘的末尾零的个数,请你设计程序帮他算

以为很简单?时间和内存限制注意哦!

输入描述 Input Description

输入一个数

输出描述 Output Description

这个数阶乘末尾零的个数

样例输入 Sample Input

5

样例输出 Sample Output

1

数据范围及提示 Data Size & Hint

有点大吧,但不是高精度

AC代码:

 

#include<cstdio>
using namespace std;
int num,n;
int main(){
    scanf("%d",&n);
    for(int i=5;i<=n;i*=5) num+=n/i;
    printf("%d",num);
    return 0;
}

 

 

 

5050 [JL] 他爱上了鸭蛋

标签:

原文地址:http://www.cnblogs.com/shenben/p/5934296.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!