N! SDUT 3138
来源:互联网 发布:传淘宝代销是什么意思 编辑:程序博客网 时间:2024/05/17 08:13
题目描述
首先很感谢刘老师能给我这次机会给大家出题,希望大家做完题后能有所收获,如果有任何问题还请海涵,毕竟出套题不容易……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.
题目整体不难,大体是给我带的大一新生出题的难度,所以请各位放心。
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).
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.
示例输入
351001024
示例输出
Case #1: 1Case #2: 24Case #3: 253
找规律,醉了吧,一直除5.
<pre name="code" class="cpp">#include<iostream>#include<algorithm>#include<cstring>#include<cstdio>using namespace std;int main(){ int n,t; cin>>t; for(int i=1; i<=t; i++) { cin>>n; int k=0; while(n!=0) { k+=n/5; n=n/5; } cout<<"Case #"<<i<<": "<<k<<endl; } return 0;}
0 0
- N! SDUT 3138
- SDUT 3931 N!
- SDUT 1882 n皇后问题
- SDUT 2413:n a^o7 !
- SDUT 2413-n a^o7 !
- SDUT OJ 2413 n a^o7 !
- n个数的排序 (sdut oj)
- sdut acm 3n+1数列问题
- sdut 2605 预处理A^N mod p
- 大家快来a水题 n 55!w ! pue n a^o7 ! n paau ! (sdut oj2413)
- SDUT 1-2 输出N个数的平方和立方值
- SDUT 3023-当N遇上M(容斥原理)
- SDUT 1447 水题(y*y = x*x + n)
- SDUT 2500 统计N!中包含末尾0 的个数
- SDUT 2059 简单n! (大数阶乘) -- 解题报告
- 计算组合数C(n,m)(SDUT 2241)
- SDUT 2017 Autumn Single Contest N 模板场
- SDUT 2411——Pixel density模拟细节WA了n遍
- bootstrap布局 网格系统
- UIWebView与js交互(二)
- 用Go写了一个小工具,用他脚本下载日志文件,然后让开发自己去下载
- c++连接mysql编程(mysq-connector/c++)
- 【JZOJ】3169 生产汽车
- N! SDUT 3138
- spark standalone zookeeper HA部署方式
- openstack 管理 三十七 - 创建 vm 并 指定IP 地址
- CO-PRIME(初探 莫比乌斯)NYOJ1066(经典)gcd(a,b)=1
- 通过xcodebulid 归档 xcarchive 导出ipa
- wxString类型转化
- Python——makefile函数
- poi导出excel表格
- LINGO出错时错误代码含义: