CT29120
The Alabast Factorial Zeros
MediumL4 · Loop LordAcceptance: 0.0%XP: 35
In the ivory gates of Alabast, Ivan the accountant keeps careful count of the abacus beads. Restore an old family record, every figure matters.
Task: Print the number of trailing zeros in n! (without computing n!).
Input format: One line with a single integer n.
Output format: Print the trailing zero count.
Constraints: 0 <= n <= 1000000000000000.
Example 1:
Input: 793271038244851
Output: 198317759561200
Example 2:
Input: 331252285391619
Output: 82813071347894
Example 3:
Input: 589289943755424
Output: 147322485938846
Constraints:
0 <= n <= 1000000000000000.