还是水题,算出N!结尾0的个数,算出约数5,25,125.。。的个数和即可
Time Limit: 1500MS | Memory Limit: 65536K | |
Total Submissions: 14736 | Accepted: 9120 |
Description
Input
Output
Sample Input
6 3 60 100 1024 23456 8735373
Sample Output
0 14 24 253 5861 2183837
Source
1 //oimonster 2 #include<cstdio> 3 #include<cstdlib> 4 #include<iostream> 5 using namespace std; 6 int s[20]; 7 int main(){ 8 int i,j,n,k,l; 9 int ss,ans; 10 scanf("%d",&n); 11 for(i=1;i<=n;i++){ 12 scanf("%d",&k); 13 ans=0; 14 /*for(l=1;l<=14;l++){ 15 if(s[l]>k)break; 16 }*/ 17 ss=5; 18 while(ss<=k){ 19 ans+=k/ss; 20 ss*=5; 21 } 22 printf("%d\n",ans); 23 } 24 return 0; 25 }
原文:http://www.cnblogs.com/oimonster/p/4320906.html