fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. long long n;
  7. cin>>n;
  8.  
  9. long long count5=0;
  10. for(long long i=5;i<=n;i+=5)
  11. {
  12. long long num=i;
  13. while(num%5 == 0)
  14. {
  15. num=num/5;
  16. count5++;
  17. }
  18. //cout<<"count2="<<count2<<" count5="<<count5<<endl;
  19. }
  20.  
  21. cout<<count5<<endl;
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.85s 5280KB
stdin
1000000000
stdout
249999998