eolymp
bolt
Try our new interface for solving problems
Məsələlər

Trailing Sifar

Trailing Sifar

\textit{Sifar} is a malay word for zero or \textbf{0}. In mathematics, trailing \textit{sifar} is a sequence of \textbf{0}s in the decimal representation of a number after which no other digits follow. The number of trailing \textit{sifar} in the decimal representation of \textbf{N!} (\textbf{5} ≤ \textbf{N} ≤ \textbf{1000000}) is simply the multiplicity of the prime factor \textbf{5} in \textbf{N!}. Given a decimal integer \textbf{N}, you are to find the number of trailing \textit{sifar} for \textbf{N!} For example, \textbf{10! = 3628800}. Thus, the number of trailing sifar for \textbf{10!} is \textbf{2}. \InputFile Each line of input contains an integer \textbf{N} where \textbf{5} ≤ \textbf{N} ≤ \textbf{1000000}. The input is terminated with a line containing \textbf{0}. \OutputFile For each test case, the output contains a line in the format \textbf{Case #x: M}, where \textbf{x} is the case number (starting from \textbf{1}) and \textbf{M} is the number of trailing sifar for \textbf{N!}
Zaman məhdudiyyəti 10 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
5
10
118
211
0
Çıxış verilənləri #1
Case #1: 1
Case #2: 2
Case #3: 27
Case #4: 51
Mənbə ACM-ICPC Malaysia al-Khawārizmī National Programming Contest 2013 (al-Khawārizmī' 2013), 21-22 September 2013