您的位置:首页 > 其它

寒假集训附加题目题解报告(3)——阶乘的0有几个?

2013-01-19 21:26 260 查看
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2500

http://acm.sdut.edu.cn:8080/judge/contest/view.action?cid=5#problem/T

重题了。。

#include "iostream"
using namespace std;
int main()
{
	long int n,a,ans;
	cin>>n;
	while(n--)
	{
		ans = 0;
		cin>>a;
		while(a)
		{
			ans+=a/5;
			a/=5;
		}
		cout<<ans<<endl;
    }
	return 0;
}


只要找5的个数就好,从开始累加。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: