HDU1124

推理

一个数字含有一个5就能有一个0,但是在计数的时候要除去这个5,再去进行新的计算。

View Code
 1 #include<stdio.h>
 2 #include<string.h>
 3 #include<math.h>
 4 typedef __int64 int64;
 5 int main(){
 6     int t;
 7     scanf("%d",&t);
 8     while( t-- ){
 9         int64 n;
10         scanf("%I64d",&n);
11         int64 ans=0;
12         int64 now=5;
13         while( n>=now ){
14             ans+=(n/now);
15             n/=now;
16         }
17         printf("%I64d\n",ans);
18     }
19     return 0;
20 }

 

posted @ 2013-02-09 21:20  xxx0624  阅读(299)  评论(0编辑  收藏  举报