Poj 1401 Factorial
2013-02-27 15:17
453 查看
这是一道水题,不解释来。
#include<stdio.h>
int main()
{
int n,ans;
//freopen("a.txt","r",stdin);
//freopen("b.txt","w",stdout);
scanf("%d",&n);
while(n--)
{
int T;
scanf("%d",&T);
int i,S=1;
ans=0;
while(S<=T)
{
S=5*S;
ans+=T/S;
}
printf("%d\n",ans);
}
//fclose(stdin);
//fclose(stdout);
return 0;
}
#include<stdio.h>
int main()
{
int n,ans;
//freopen("a.txt","r",stdin);
//freopen("b.txt","w",stdout);
scanf("%d",&n);
while(n--)
{
int T;
scanf("%d",&T);
int i,S=1;
ans=0;
while(S<=T)
{
S=5*S;
ans+=T/S;
}
printf("%d\n",ans);
}
//fclose(stdin);
//fclose(stdout);
return 0;
}
相关文章推荐
- POJ 1401 Factorial 解题报告
- poj1401--Factorial
- Poj 1401 Factorial(计算N!尾数0的个数——质因数分解)
- poj 1401 Factorial
- POJ_1401_Factorial(阶乘末尾0)
- POJ 1401:Factorial 求一个数阶乘的末尾0的个数
- poj 1401 Factorial
- Poj 1401 Factorial(计算N!尾数0的个数——质因数分解)
- poj1401——Factorial
- poj 1401 Factorial
- POJ 1401:Factorial 求一个数阶乘的末尾0的个数
- POJ1401 - Factorial
- 【POJ】1401 - Factorial(阶乘最后0的个数)
- POJ1401-Factorial
- zoj 2022||poj 1401 Factorial(阶乘)
- POJ 1401 Factorial (对数学知识考…
- POJ 1401 Factorial
- POJ 1401 && ZOJ 2202 Factorial 阶乘N!的末尾零的个数
- POJ 1401 Factorial
- poj 1401 Factorial