N!
2015-08-18 15:36
483 查看
N!
Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
首先很感谢刘老师能给我这次机会给大家出题,希望大家做完题后能有所收获,如果有任何问题还请海涵,毕竟出套题不容易……TAT题目整体不难,大体是给我带的大一新生出题的难度,所以请各位放心。
If you want to learn something from other people, remember, stay hunger.---shadow95
Now, your first problem comes~
This task is very simple, please calculate how many zeros are there at the end of calculation of n!.
For example, 15! = 1307674368000, so answer is 3.
输入
At the first line, there is a number T indicating the number of test cases.Then, following T lines, each line there is a number n (n<10^9).
输出
For each case, output the case number and answer in one line.示例输入
3 5 100 1024
示例输出
Case #1: 1 Case #2: 24 Case #3: 253
提示
来源
HDU shadow95示例程序
view plaincopyprint如果您复制代码时出现行号,请点击左边的“viewplain”后再复制
#include<stdio.h>
#include<string.h>
int fun(int n)
{
int sum=0;
while(n)
{
n=n/5;
sum+=n;
}
return sum;
}
int main()
{
int t, T, n;
scanf("%d", &T);
for(int t=1;t<=T;t++)
{
scanf("%d", &n);
int re=fun(n);
printf("Case #%d: %d\n", t, re);
}
return 0;
}
相关文章推荐
- JVM内存管理:深入Java内存区域与OOM
- 树-堆结构练习——合并果子之哈夫曼树
- hdu 4548 第六周H题(美素数)
- jquery selector 基础
- SoundPool
- 两个数种输出最大最小值
- 将VC++动态链接库封装成C#可以用的动态链接库步骤
- Lucene经典学习资料(不断更新)
- c++面向对象编程必备“良方”
- 有关openCV在QT环境的配置
- 判断以逗号分隔的字符串中是否包含某个数
- maven的一些内置变量和常识
- 图的遍历之 深度优先搜索和广度优先搜索
- creationComple
- Android 4.4 自动拨打分机流程分析
- 数据结构实验之求二叉树后序遍历和层次遍历
- 人脸性别识别文献阅读笔记(1)
- poj 1160 Post Office (间隔DP)
- 宜家的幸福生活,源于K2 BPM的支撑
- maven Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10: