#CCBCHMOT0000057. Các chữ số 0 tận cùng (Trailing Zeros)
Các chữ số 0 tận cùng (Trailing Zeros)
Trailing Zeros
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , calculate the number of consecutive trailing zeros in the decimal representation of the factorial . You only need to output the number of trailing zeros, not the factorial.
Input
One line contains the positive 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
20
Output
4
Explanation
contains the four multiples 5,10,15,20; each contributes one factor five, so there are four trailing zeros.
Example 2
Input
25
Output
6
Explanation
There are five multiples of five and 25 contributes one more factor, giving six zeros.