Problem:


Score : 500 points

Problem Statement

For an integer n not less than 0, let us define f(n) as follows:

f(n) = 1 (if n < 2)

f(n) = n f(n-2) (if n \geq 2)

Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N).

Constraints

0 \leq N \leq 10^{18}

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of trailing zeros in the decimal notation of f(N).

Sample Input 1

12

Sample Output 1

1

f(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080, which has one trailing zero.

Sample Input 2

5

Sample Output 2

0

f(5) = 5 × 3 × 1 = 15, which has no trailing zeros.

Sample Input 3

1000000000000000000

Sample Output 3

124999999999999995



Sample input:
12


Sample output:
1

Submission status: Wrong Answer

Solution code:
import sys
from itertools import accumulate, repeat, takewhile
from operator import mul


def main():
    N = int(next(sys.stdin.buffer))
    print(sum(N // x for x in takewhile(lambda x: x <= N, accumulate(repeat(5), mul, initial=10))))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
if n % 2 == 0:
    print(0)
    exit(0)
cnt = 0
five = 2 * 5
while n / five > 0:
    cnt += n // five
    five *= 5
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
five = 2 * 5
while n / five > 0:
    cnt += n // five
    five *= 5
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
five = 5
while n / (2 * five) > 0:
    cnt += n / (2 * five)
    five *= 5
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
five = 5
while n // (2 * five) > 0:
    cnt += n // (2 * five)
    five *= 5
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
x = len(str(n))

if n % 2 == 1:
  print(0)
else:
  for i in range(1,26):
    cnt += n//((5**i)* 2)


print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
x = len(str(n))

if n % 2 == 1:
  print(0)
else:
  for i in range(1,27):
        cnt += n//((5**i)* 2)


print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
x = len(str(n))

if n % 2 == 1:
  print(0)
else:
  for i in range(1,26):
        cnt += n//((5**i)* 2)


print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
x = len(str(n))

if n % 2 == 1:
  print(0)
else:
  for i in range(1,x+1):
        cnt += n//((5**i)* 2)


print(cnt)

Submission status: Wrong Answer

Solution code:
5

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 1
cnt = 0
an = 0
for i in range(N+1 // 2):
    if N >= 2:
        ans *= N
        N -= 2
    else:
        break

ans = str(ans)
for i in range(len(ans)):
    if ans[i] == "0":
        cnt += 1
    else:
        if an < cnt:
            an = cnt
        cnt = 0
print (an)

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

if N == 0:
    print(1)
    sys.exit()

if N % 2 == 0:
    k = N // 2
    tmp = 5
    ans = 0
    while k >= tmp:
        ans += k // tmp
        tmp *= 5
else:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
cnt = 0
N //= 2
while N:
    cnt += N//5
    N //= 5
print(cnt)

Submission status: Wrong Answer

Solution code:
def wtf(x):
    twos = 0
    fives = 0
    for j in range(1, 60):
        bs = 2 ** j
        twos = twos + x // bs
        bs = 2 * 5 ** j
        fives = fives + x // bs
    return min(twos, fives)
print(wtf(int(input())))

Submission status: Wrong Answer

Solution code:
n=int(input())
while n%10!=0:
    n-=2
ans=0
num=9
print(len(str(n))-2,n)
for i in range(1,len(str(n))-1)[::-1]:
    print(num,i)
    ans+=num*i
    num*=9

Submission status: Wrong Answer

Solution code:
from math import floor
n = int(input())
if n % 2 != 0:
    print(0)
else:
    ans = 0
    t = 10
    while n >= t:
        ans += floor(n/t)
        t *= 5
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N % 2 == 1:
    print(0)
    exit(0)

n = 10
ans = 0
while True:
    if n >= N:
        break
    ans += N//n
    n *= 5

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n%2!=0:
  print(0)
  exit(0)
n//=10

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

n=Base_10_to_n(n,5)
n=reversed(list(n))
tmp=1
ans=0
for i in n:
  ans+=int(i)*tmp
  tmp=tmp*5+1
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n%2!=0:
  print(0)
  exit(0)
n//=10

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

n=Base_10_to_n(n,5)
n=reversed(list(n))
tmp=1
ans=0
for i in n:
  ans+=int(i)*tmp
  tmp=tmp*5+1
print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
  N = int(input())

  multiplier = 10
  result = 0
  while multiplier <= N:
    result += N // multiplier
    multiplier *= 5

  print(result)

if __name__ == "__main__":
  resolve()

Submission status: Wrong Answer

Solution code:
def main():
  import math
  N = int(input())
  if N % 2 != 0:
    print(0)
    exit()
  ans = 0
  i = 1
  while 2*5**i<=N:
    ans += math.floor(N/(2*(5**i)))
    i += 1
      
  print(ans)
main()

Submission status: Wrong Answer

Solution code:
def main():
  import math
  N = int(input())
  if N % 2 != 0:
    print(0)
    exit()
  ans = 0
  for i in range(1, 27):
    if 2*5**i > N:
      break
    else:
      ans += math.floor(N/(2*(5**i)))
  print(ans)
main()

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0
if n & 2 == 1:
    ans = 0
else:
    ans += n//10
    n = n//10
    while n > 1:
        ans += n//5
        n = n//5
        # print(n)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
i = 2
a = 0
while i <= N:
    a += N // i
    i *= 2
i = 2*5
b = 0
while i <= N:
    b += N // i
    i *= 5
print(min(a,b))

Submission status: Wrong Answer

Solution code:
N = int(input())
i = 2
a = 0
while i < N:
    a += N // i
    i *= 2
i = 2*5
b = 0
while i < N:
    b += N // i
    i *= 5
print(min(a,b))

Submission status: Wrong Answer

Solution code:
import math
N = int(input())

if N < 2 or N % 2 == 1:
  print(0)
  exit()
  
res = 0

de = 10
while 1:
  quot = math.floor(N / de)
  if quot == 0:
    break
  res += quot
  de *= 5
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N < 2 or N % 2 == 1:
  print(0)
  exit()
  
res = 0

de = 10
while de < N + 1:
  res += int(N / de)
  de *= 5
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N < 2 or N % 2 == 1:
  print(0)
  exit()
  
res = 0
l = len(list(map(int, list(str(N)))) )

de = 10
while de < N + 1:
  res += int(N / de)
  de *= 5
print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 2 != 0:
    print(0)
else:
    ans = 0
    n //= 2
    tmp = 5
    while n > tmp:
        ans += n//tmp
        tmp *= 5
    
    
    print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 2 != 0:
    print(0)
else:
    ans = 0
    tmp = n/2
    while tmp:
        tmp //= 5
        ans += tmp
    
    print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 2 != 0:
    print(0)
else:
    ans = 0
    tmp = n/2
    while tmp:
        tmp /= 5
        ans += tmp
    
    print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=0
i=1
while 1:
	if n<5**i:
		break
	s+=(n+5)//((5**i)*2)
	i+=1
print(0 if n%2 else s)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 0:
    print(0)
if n == 1:
    print(0)
else:
    if n % 2 ==1:
        print(0)
    else:
        ans = 0
        i = 1
        while  True:
            ans_plus=n//(2*5**i)
            if ans_plus==0:
                break
            ans += ans_plus
            
            i += 1
        print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 0:
    print(0)
if n == 1:
    print(0)
else:
    if n % 2 ==1:
        print(0)
    else:
        ans = 0
        l = 10
        while n>=l:
            ans += n//l
            l *= 5
        print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
if n == 0:
    print(0)
if n == 1:
    print(0)
else:
    if n % 2 ==1:
        print(0)
    else:
        ans = 0
        l = 5
        while n>=l:
            ans += n//(l*2)
            l *= 5
        print(ans)

Submission status: Wrong Answer

Solution code:
def cnt_prime(p, n):
    div = n
    s = 0

    while True:
        div /= p
        if div < 1:
            break
        if p == 2:
            s += int(div)
        else:
            s += int(div) // 2

    return s

N = int(input())

if N == 0:
    print(1)
elif N % 2 == 1:
    print(0)
else:
    print(min(cnt_prime(2, N), cnt_prime(5, N)))

Submission status: Wrong Answer

Solution code:
def cnt_prime(p, n):
    div = n
    s = 0

    while True:
        div /= p
        if div < 1:
            break
        if p == 2:
            s += int(div)
        else:
            s += int(div) // 2

    return s

N = int(input())

if N % 2 == 1:
    print(0)
else:
    print(min(cnt_prime(2, N), cnt_prime(5, N)))

Submission status: Wrong Answer

Solution code:
def cnt_prime(p, n):
    div = n
    s = 0

    while True:
        div /= p
        if div < 1:
            break
        s += int(div) // 2

    return s

N = int(input())

if N % 2 == 1:
    print(0)
else:
    print(min(cnt_prime(2, N), cnt_prime(5, N)))

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2:print(0)
two = 0
five = 0
val = 2
while val<=n:
    two+=n//val
    val *= 2
val = 5
while val<=n:
    five +=(n//val)//2
    val *=5
print(min(two,five))

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 2 == 0:
    n5 = 1
    y = 10

    while n % y == 0:
        n5 += 1
        y = 2*(5**n5)

    n5 -= 1
    c = [n//(2*(5**i)) for i in range(1, n5+1)]

    cnt = 0
    for i in range(n5):
        if i != n5-1:
            c[i] -= c[i+1]

        cnt += c[i]*(i+1)

    print(cnt)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

# 奇数始まりは必ず0
if n % 2 == 1:
    print(0)
    sys.exit()

# 5の因子を数える
# 5の倍数は10個ごと、25の倍数は50個ごと、125の倍数は250個ごとに登場する
ans = 0
cnt = 1
while 5**cnt * 2 < n:
    ans += n // (5**cnt * 2)
    cnt += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

# 奇数始まりと10未満は必ず0
if n % 2 == 1 or n < 10:
    print(0)
    sys.exit()

# 5の因子を数える
# 5の倍数は10個ごと、25の倍数は50個ごと、125の倍数は250個ごとに登場する
ans = 0
cnt = 1
while 5**cnt * 2 < n:
    ans += n // (5**cnt * 2)
    cnt += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%2==1:
  print(0)
else:
  N = N//2
  ans = 0
  while N>5:
    ans += N//5
    N = N//5
  print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0
if n % 2 == 0:
    for i in range(1, 18):
        k = 10**i
        ans += n//k
    print(ans)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

n = int(input())

if n%2 == 1:
    print(0)
    exit()

mp = tmp = 0 
while True:
    if 5**tmp > n:
        break
    mp = tmp 
    tmp += 1

ans = 0 
for i in range(1, mp+1):
    ans += n//(5**i)

print(ans//2)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 0
if N == 0 or N % 2 == 1:
    ans = 0
else:
    # means N >= 2 and even
    digN = round( math.log(N , 10) )

    i = 1
    while i <= digN:
        ans +=  ( N // ( 10 ** i ) )
        i += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2 != 0:
    print(0)
else:
    ans = 0
    dum = 5
    while n > dum:
        ans += (n//dum)*(1/2)
        dum = dum*5
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2 != 0:
    print(0)
else:
    dum = n//10
    ans = dum
    keta = 1
    while dum != 0:
        dum = dum//10
        ans -= (keta * dum)
        keta += 1
        ans += (keta * dum)
    print(ans)

Submission status: Wrong Answer

Solution code:
def findTrailingZeros(n):   
    count = 0
    i=10
    while (n/i>=1): 
        count += int(n/i) 
        i *= 10
    return int(count) 

print(findTrailingZeros(5))

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
n_5=0
n_10=0
if n%2==0:
    for i in range(1,19):
        ans+=n//(10**i)
x=n//10
for i in range(1,26):
    n_5+=x//(5**i)
for i in range(1,18):
    n_10+=x//(10**i)
ans+=n_5-n_10
print(ans)

Submission status: Wrong Answer

Solution code:
def calculate(n):
    if n % 2 == 1:
        return
    s1 = n // 10
    index = 1
    s2 = 0
    while (5 ** index) <= s1:
        s2 += (s1 // (5 ** index))
        index += 1
    return s1 + s2
print(calculate(int(input())))

Submission status: Wrong Answer

Solution code:
def calculate(n):
    s1 = n // 10
    index = 1
    s2 = 0
    while (5 ** index) <= s1:
        s2 += (s1 // (5 ** index))
        index += 1
    return s1 + s2
print(calculate(int(input())))

Submission status: Wrong Answer

Solution code:
def trail(n,sol=0, i = 1):
    while (n//5**i)>1:
        sol += n//5**i
        i+=1
    if n<10**10:
        print(sol//2)
    else:
        print(((sol//2)//10)*10+5)
trail(int(input()))

Submission status: Wrong Answer

Solution code:
N = int(input())

if (N%2 == 1):
    print(0)
elif N == 0:
    print(0)
else:
    N //= 2
    res = 0
    div_coef = 1
    while True:
        tmp_add = N // (5 ** div_coef)
        res += int(tmp_add)
        div_coef += 1
        print(int(tmp_add))
        if tmp_add < 1:
            break
    # print(N)
    print(int(res))

Submission status: Wrong Answer

Solution code:
N = int(input())

if (N%2 == 1):
    print(0)
elif N == 0:
    print(0)
else:
    N /= 2
    res = 0
    div_coef = 1
    while True:
        # print(N)
        tmp_add = N // (5 ** div_coef)
        res += int(tmp_add)
        div_coef += 1
        if tmp_add < 1:
            break
    # print(N)
    print(int(res))

Submission status: Wrong Answer

Solution code:
N = int(input())

if (N%2 == 1):
    print(0)
elif N == 0:
    print(1)
else:
    N /= 2
    res = 0
    div_coef = 1
    while True:
        # print(N)
        tmp_add = N // (5 ** div_coef)
        res += int(tmp_add)
        div_coef += 1
        if tmp_add < 1:
            break
    # print(N)
    print(int(res))

Submission status: Wrong Answer

Solution code:
N = int(input())

if (N%2 == 1):
    print(0)
elif N == 0:
    print(1)
else:
    N /= 2
    res = 0
    div_coef = 1
    while True:
        # print(N)
        tmp_add = N // (5 ** div_coef)
        res += int(tmp_add)
        div_coef += 1
        print(tmp_add)
        if tmp_add < 1:
            break
    # print(N)
    print(int(res))

Submission status: Wrong Answer

Solution code:
N = int(input())

if (N%2 == 1):
    print(0)
elif N == 0:
    print(1)
else:
    N /= 2
    cnt = 1
    tmp_div_num = 0
    while True:
        # print(N)
        cnt += N // 5
        N /= 5
        if N < 5:
            break
    # print(N)
    print(int(cnt)-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
n = 0
if not N%2:
    s = 5
    N = N//2
    while N>s:
        n += N//s
        s *= 5
print(n)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==0 or n%2==1:
  print(0)
if n%2==0:
  k=n//2
  s=5
  ans=0
  while k>=s:
    ans+=k//s
    s*=5
  print (ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

res = 0
fives = 10
while True:
    if N // fives == 0:
        break
    res += N//fives
    fives *= 5
print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = 0
m = n // 2
while True:
  m = m // 5
  a += m
  if m == 0:
    break
print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = 0
m = n
while True:
  m = m // 5
  a += m
  if m == 0:
    break
print(a)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
cnt = 0
mod = 5
while mod<=n:
    cnt += n//mod
    mod*=5
print(cnt)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
cnt = 0
mod = 10
while mod<=n:
    cnt += n//mod
    mod*=5
print(cnt)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
cnt = 0
mod = 10
while mod<=n:
    cnt += math.floor(n/mod)
    mod*=5
print(cnt)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
cnt = 0
mod = 10
while math.floor(n/mod) !=0:
    cnt += math.floor(n/mod)
    mod*=5
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
mod = 10
while n//mod !=0:
    cnt += n//mod
    mod*=5
print(cnt)

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools, bisect
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def S(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

alphabets = "abcdefghijklmnopqrstuvwxyz"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    N = I()

    ans = 0
    for i in range(1, 30):
        ans += N // (2 * 5 ** i)

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

ans = 0
if N%2==1:
    print(0)
    exit(0)
for i in range(1, 20):
    cnt = N//(5**i)
    ans += int(cnt/2)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

ans = 0
for i in range(1, 20):
    cnt = N//(5**i)
    if N%2!=0:
        ans += -(-cnt//2)
    else:
        ans += int(cnt/2)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

cnt = 0
n = 1
while n <= N:
    n *= 5
    if(n > N):
        break
    
    num = n*2
    cnt += N//num
print(cnt)

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=0
if N%2==0:
    for i in range(1,19):
        ans+=N//(10**i)
print(ans)

Submission status: Wrong Answer

Solution code:
import  math

# n = 1000000000000000000
n = int(input())

# nが奇数ならば必ず0
if n % 2:
    print(0)
else:
    s = 0
    for p in range(0, 50):
        if 10 * (5 ** p) <= n:
            s += math.floor(n / (10 * (5 ** p)))
        else:
            break

    print(s)

# 298023223876953125
# 1490116119384765625
# 1000000000000000000

# dividers = [(p, 5 ** p) for p in range(1, 26)]

Submission status: Wrong Answer

Solution code:
import  math

# n = 1000000000000000000
n = int(input())

# nが奇数ならば必ず0
if n % 2 or n < 10:
    print(0)
else:
    s = 0
    for p in range(0, 50):
        if 10 * (5 ** p) < n:
            s += math.floor(n / (10 * (5 ** p)))
        else:
            break

    print(s)

# 298023223876953125
# 1490116119384765625
# 1000000000000000000

# dividers = [(p, 5 ** p) for p in range(1, 26)]

Submission status: Wrong Answer

Solution code:
import  math

# n = 1000000000000000000
n = int(input())

# nが奇数ならば必ず0
if n % 2 or n < 10:
    print(0)
else:
    s = 0
    for p in range(0, 26):
        s += math.floor(n / (10 * (5 ** p)))

    print(s)

# 298023223876953125
# 1490116119384765625
# 1000000000000000000

# dividers = [(p, 5 ** p) for p in range(1, 26)]

Submission status: Wrong Answer

Solution code:
import  math

# n = 1000000000000000000
n = int(input())

# nが奇数ならば必ず0
if n % 2 or n < 10:
    print(0)
else:
    s = 0
    for p in range(0, 25):
        s += math.floor(n / (10 * (5 ** p)))

    print(s)

# 298023223876953125
# 1490116119384765625
# 1000000000000000000

# dividers = [(p, 5 ** p) for p in range(1, 26)]

Submission status: Wrong Answer

Solution code:
n = int(input())

memo = [0] *100#(n+1)

def f(n):
    if n%2 == 0:
        if n == 0:
            return 1
        if memo[n]:
            return n*f(n-2)
        else:
            memo[n] = n*f(n-2)
            return memo[n]
    if n%2 == 1:
        if n == 1:
            return 1
        if memo[n]:
            return n*f(n-2)
        else:
            memo[n] = n*f(n-2)
            return memo[n]

cnt10 = n//10

i = 1
cnt = 0
while 5**i*10 <=n:
    a = 5**i*10
    cnt += n//a
    i +=1
print(cnt+cnt10)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N%2 == 1 or N == 0:
  print(0)
else:
  print(N//10)

Submission status: Wrong Answer

Solution code:
N = int(input())
print(N//10+N//50)

Submission status: Wrong Answer

Solution code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    if n%2 == 1:
        print(0)
        exit(0)
    
    def count(k, n):
        now = k
        cnt = 0
        while now < n:
            cnt += n//now
            now *= k
        return cnt

    n //= 2
    cnt2 = n
    cnt2 += count(2, n)
    cnt5 = count(5, n)
    ans = min(cnt2, cnt5)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    if n%2 == 1:
        print(0)
        exit(0)
    
    def count(k, n):
        now = k
        cnt = 0
        while now < n:
            cnt += n//now
            now *= k
        return cnt

    cnt2 = n
    n //= 2
    cnt2 += count(2, n)
    cnt5 = count(5, n)
    ans = min(cnt2, cnt5)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    if n%2==1:
        print(0)
        return
    md = 10
    cnt = 0
    while n>md:
        cnt += n//md
        md = md*5
    print(cnt)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
input = stdin.readline


def main():
  N = int(input())

  nz = 0
  i = 1
  while True:
    if N//(5**i)//2 > 0:
      nz += (N//(5**i)//2)
      i += 1
    else:
      break

  print(nz)


if(__name__ == '__main__'):
  main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline


def main():
  N = int(input())

  nz = 0
  i = 1
  while True:
    if N//5**i//2 > 0:
      nz += N//5**i//2
      i += 1
    else:
      break

  print(nz)


if(__name__ == '__main__'):
  main()

Submission status: Wrong Answer

Solution code:
N = int(input())
n = N // 10
cnt = 0

while n != 0:
    cnt += n
    n //= 5
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())

# Lv.1
#def f(t):
#    return 1 if t < 2 else t * f(t-2)
#print(f(n))

# Lv.2
# def g(p):
#     d = {2:0, 5:0}
#     for i in range(p, 1, -2):
#         t = i
#         while(t % 2 == 0):
#             t //= 2
#             d[2] += 1
#         while(t % 5 == 0):
#             t //= 5
#             d[5] += 1
#     return min(d[2], d[5])
# print(g(n))

# Lv.3
# 1,3,5,7,... 末尾は奇数
# 2,4,6,8,... Lv.2 の print(min(d[2], d[5])) は 5の方が常にmin
# 100 の時 10 で割れるのが10, 50で割れるのが2つ
# 250 の時 10 で割れるのが25, 50で割れるのが5つ, 250 で割れるのが1つ 1000個位出してみたら ? 整数分割の + - 交互のあれでは無いっぽい
k = 10
ans = 0
while k < n:
    ans += n // k
    k = k * 5
print(ans if n % 2 == 0 else 0)

Submission status: Wrong Answer

Solution code:
n = int(input())

# Lv.1
#def f(t):
#    return 1 if t < 2 else t * f(t-2)
#print(f(n))

# Lv.2
# def g(p):
#     d = {2:0, 5:0}
#     for i in range(p, 1, -2):
#         t = i
#         while(t % 2 == 0):
#             t //= 2
#             d[2] += 1
#         while(t % 5 == 0):
#             t //= 5
#             d[5] += 1
#     return min(d[2], d[5])
# print(g(n))

# Lv.3
# 1,3,5,7,... 末尾は奇数
# 2,4,6,8,... Lv.2 の print(min(d[2], d[5])) は 5の方が常にmin
# 100 の時 10 で割れるのが10, 50で割れるのが2つ
# 250 の時 10 で割れるのが25, 50で割れるのが5つ, 250 で割れるのが1つ 1000個位出してみたら ? 整数分割の + - 交互のあれでは無いっぽい
k = 10
ans = 0
while k < n:
    ans += n // k
    k = k * 5
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

# N:奇数ならば0
# N:偶数の場合 10が何個登場するか (素因数分解したときに2,5のペアが何個登場するか)
# 偶数の場合のみ考えているので 5 << 2と考えて5が何回登場するかを考える。
# 2で割ると(N//2)!になる
# 5 >> 2を仮定するとN//2までの5の倍数となっている数が答え

if N % 2 != 0:
    print(0)
    exit()

print((N // 2 // 5))

Submission status: Wrong Answer

Solution code:
N = int(input())

if N % 2 == 1:
    print(0)
else:
    n = 0
    i = 1
    while True:
        n += N // 10**i
        if N < 10**i:
            break
        i += 1
    print(n)

Submission status: Wrong Answer

Solution code:
# 50
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
if n % 2 != 0:
    print(0)
    exit()
ans = n // 10
print(ans)

Submission status: Wrong Answer

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
cnt = [0]*20
cnt[1] = 1
for i in range(1,19):
    cnt[i+1] = cnt[i]*10 + 1
N = int(readline())
if N % 2 == 1:
    print(0)
    sys.exit()
N_str = str(N)
N_str = N_str[::-1]
S = len(N_str)
ans = 0
for i in range(S):
    ans += int(N_str[i])*cnt[i]
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
M = 10
ans = 0

if N % 2 == 0:
  while N > M:
    ans += N//M
    M *= 5
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
M = 10
ans = 0

while N > M:
  ans += N//M
  M *= 5
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
if n==0:
    ans=1
if n%2==0:
    for i in range(1,30):
        m=n//((5**i)*2)
        ans+=m
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
a = 10
while True:
    if N < a:
        break

    ans += N//a
    a *= 5
print(ans)

Submission status: Wrong Answer

Solution code:
# import math
N = int(input())

# Nが奇数の場合は-2していくと全て奇数になるので答えは0
# Nが偶数の場合を検討するべし
# Nが偶数の場合、明らかに2の倍数より5の倍数の方が少ないので5の倍数がいくつかで考える
bunbo = 0
sum_5 = 0
while (10 * 5 ** bunbo) <= N:
    sum_5 += N // (10 * 5**bunbo)
    bunbo += 1

print(sum_5)

Submission status: Wrong Answer

Solution code:
N = int(input())

k = 10
ans = 0
if N % 2 != 0:
    ans = 0
elif N == 0:
    ans = 1
else:
    while k <= N:
        ans += N // k
        k *= 5

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

k = 10
ans = 0
if N % 2 != 0:
    ans = 0
elif N == 0:
    ans = 1
else:
    while k < N:
        ans += N // k
        k *= 5

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
tmp = 10
ans = 0
while tmp <= n:
    ans += n//tmp
    tmp *= 5
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
tmp = 10
ans = 0
while tmp < n:
    ans += n//tmp
    tmp *= 5
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
from math import log10, floor
def main():
    n = int(input())
    if n <= 9 or n % 2 == 1:
        print(0)
        sys.exit()
    tanni = 0
    keta = floor(log10(n))
    r = 0
    n2 = list(map(int, str(n)))[::-1]    
    for i1 in range(1, keta + 1):
        tanni = tanni * 10 + 1
        print(tanni)
        r += tanni * n2[i1]
    print(r)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2 == 0:
    i = 1
    ans = 0
    while 2*pow(5,i) < n:
        ans += n//(2*pow(5,i))
        i += 1
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())

k = 5
ans = 0
while k<N:
    ans += (N//2)//k
    k*=5
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
N = N//2
ans = 0
if N % 2:
    print(0)
    exit()
while N:
    ans += N // 5
    N //= 5
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input());
if(n % 2 == 1):
    print(0);
else:
    numzeroes = 0;
    numzeroes = numzeroes + int(n/10);
    mult = 50;
    while(mult <= n):
        numzeroes = numzeroes + int(n/mult);
        mult = mult * 5;
    print(numzeroes);

Submission status: Wrong Answer

Solution code:
N = int(input())
ans =0
if N %2 ==1:
    ans =0
else:
    for i in range(1,100): #N //10 +N//100 +・・+N//(10**18)
        ans +=N//(10**i) +(N//(5*10**i) +1)//2 
print(ans)

Submission status: Wrong Answer

Solution code:
N = input()
S = len(N)
N = int(N)
ans = 0

if N % 2 == 1 or N < 10:
    print(0)
    exit()

N = str(N)
for i in range(1,S):
    if len(N[i:]) == 1:
        ans += i * int(N[-i-1])
    else:
        ans += i * 9 * int(N[:-i-1]) + i * int(N[-i-1])
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n%2==1:
    print(0)
    exit(0)

k=n//2

from math import floor

ans=0
deno=5
while deno<=k:
    ans+=floor(k/deno)
    deno*=5

print(ans)