加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

sdut2500 0\'s 阶乘相关

发布时间:2020-12-14 04:08:21 所属栏目:大数据 来源:网络整理
导读:求阶乘末尾零个数的方法,刚学会的 具体参见http://blog.sina.com.cn/s/blog_4fd55a4f01007ugc.html http://blog.sina.com.cn/s/blog_5f36f8370100eb0h.html #includeiostream#includecstring#includecstdio#define ll long long using namespace std;ll a;l

求阶乘末尾零个数的方法,刚学会的

具体参见http://blog.sina.com.cn/s/blog_4fd55a4f01007ugc.html

http://blog.sina.com.cn/s/blog_5f36f8370100eb0h.html

#include<iostream>
#include<cstring>
#include<cstdio>
#define ll long long 
using namespace std;
ll a;
ll f(ll t){
	if(t<5) return 0;
	return t/5+f(t/5);
}
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		scanf("%ld",&a);
		printf("%ldn",f(a));
	}
	return 0;
}
 



/**************************************
	Problem id	: SDUT OJ 2500 
	Result		: Accepted 
	Take Memory	: 456K 
	Take Time	: 0MS 
	Submit Time	: 2013-06-02 00:43:23  
**************************************/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读