fork(2) download
  1. // Shashank Jain
  2. #include<iostream>
  3. #include<cstdio>
  4. #define LL long long int
  5. using namespace std;
  6. LL n;
  7. LL power(LL num)
  8. {
  9. LL sum=0,m,temp;
  10. m=n;
  11. while(m>0)
  12. {
  13. temp=m/num;
  14. sum+=temp;
  15. m/=num;
  16. }
  17. return sum;
  18. }
  19. int main()
  20. {
  21. int t;
  22. LL k1,k2,ans;
  23. scanf("%d",&t);
  24. while(t--)
  25. {
  26. scanf("%lld",&n);
  27. k1=power(2);
  28. k2=power(5);
  29. ans=min(k1,k2);
  30. printf("%lld\n",ans);
  31. }
  32. return 0;
  33. }
  34. // Voila
Success #stdin #stdout 0s 2900KB
stdin
6
3
60
100
1024
23456
8735373
stdout
0
14
24
253
5861
2183837