fork download
  1. // Shaazzz
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. int main()
  5. {
  6. long long n, tot = 0, now = 5;
  7. scanf("%lld", &n);
  8. while (now <= n)
  9. {
  10. tot += (n / now) * (n / now - 1) / 2 * now;
  11. tot += (n % now + 1) * (n / now);
  12. now *= 5;
  13. }
  14. return !printf("%lld", tot);
  15. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
Standard output is empty