您的位置:首页 > 其它

HDU 1124 Factorial 水题

2012-12-04 22:01 405 查看
题意:统计n!后面有几个0, 2肯定够用,只要算n!里有几个5就可以了

View Code

#include<cstdio>
#include<cstring>
int main()
{
int cas, n;
scanf("%d", &cas);
while(cas--)
{
scanf("%d", &n);
int s = 5, ans = 0;
while(s <= n)
ans += n/s, s *= 5;
printf("%d\n", ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: