PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000202. Số chữ số 0 cuối của giai thừa (Factorial)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số chữ số 0 cuối của giai thừa (Factorial)
Factorial
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
For a positive integer , its factorial is . In decimal notation, the factorial may end with a sequence of zero digits. For example, has one trailing zero and has two.
Given , determine the number of consecutive zero digits at the end of . You do not need to output the factorial itself.
Input
The only line contains the integer .
Output
Print one integer: the number of trailing zeros of .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
100
Output
24
Explanation
For , multiples of contribute factors of . Multiples of contribute another factors. There are no multiples of . Thus there are factors of , and there are more factors of , so the answer is .