fork download
  1.  
  2. #include<bits/stdc++.h>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. long int noz(long int a);
  7. int main ()
  8. {
  9. int test;
  10. cin >> test;
  11. for (int i = 0; i < test; i++)
  12. {
  13. long int n;
  14. cin >> n;
  15. cout << noz(n) << endl;
  16. }
  17.  
  18. return 0;
  19. }
  20.  
  21. long int noz(long int a)
  22. {
  23. long int n = 5;
  24. long int counter = 0;
  25. while ((a / n) >= 1)
  26. {
  27. counter += (a/n);
  28. n *= 5;
  29.  
  30. }
  31. return counter;
  32. }
  33.  
  34.  
Success #stdin #stdout 0s 4548KB
stdin
1
1000000000
stdout
249999998