#CCBCHMOT0000055. Bội của 10 trong n! (Trailing Zeros in a Factorial)
Bội của 10 trong n! (Trailing Zeros in a Factorial)
Trailing Zeros in a Factorial
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a nonnegative integer , let for and . Determine the number of consecutive trailing zero digits in the decimal representation of . You do not need to print the factorial.
Input
One line contains a nonnegative integer .
Output
Print one integer: the number of trailing zero digits in .
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input
0
Output
0
Explanation
By definition, , which has no trailing zero.
Example 2
Input
25
Output
6
Explanation
Multiples of five contribute five factors of five, and 25 contributes one additional factor. Thus .