fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int N = 1e5;
  4.  
  5. int n;
  6.  
  7. int main() {
  8. ios::sync_with_stdio(0);
  9. cin.tie(0);cout.tie(0);
  10.  
  11. cin >> n;
  12. int c5 = 0;
  13. for (int i = 1; i <= n; i ++){
  14. int x = i;
  15.  
  16. while ( x % 5 == 0 ){
  17. x /= 5;
  18. c5 ++;
  19. }
  20. }
  21.  
  22. cout << c5;
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 5276KB
stdin
20
stdout
4