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: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N=ii()
    if N&1==1:
        print(0)
        return
    ans = 0
    fi = 10
    while N >= fi:
        ans += N//fi
        fi *= 5
    print(ans)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 0:
    total = 0
    temp = (N // 2) // 5
    total += temp
    while temp:
        temp //= 5
        total += temp
    print(total)
else:
    print(0)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 1:
	print(0)
else:
	m2 = 1
	m5 = 0
	for i in range(1, 101):
		if n // 2 >= 2 ** i:
			m2 += (n // 2) // (2 ** i)
		else:
			break
	for j in range(1, 101):
		if n // 2 >= 5 ** j:
			m5 += (n // 2) // (5 ** j)
		else:
			print(min(m2, m5))
			break

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

if N % 2 != 0:
    pass
else:
    for i in range(0, 25):
        ans += N // (10*5**i)

print(ans)

Submission status: Accepted

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

if N % 2 == 1:
    pass
else:
    div = 10
    for i in range(0, 25):
    #while div <= N:
        ans += N // div
        div *= 5

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
ans = 0

if N % 2 == 1:
    pass
else:
    div = 10
    #for i in range(0, 25):
    while div <= N:
        ans += N // div
        div *= 5

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

cnt = 0
div = 10
while div <= n:
    cnt += n // div
    div *= 5

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
if N%2==1:
  print(0)
  exit()
else:
  ans = 0
  for i in range(1,19):
    ans +=N//(10**i)
    l=1
    while N>=10**i*5**l: 
      m=N//(10**i*5**l)
      if m%2==0:
        ans+=m//2
      else:
        ans+=(m+1)//2
      l+=1
print(ans)

Submission status: Accepted

Solution code:
import re
import numpy as np
n = int(input())

if n % 2:
    print(0)
else:
    ans = 0
    x = 10
    for i in range(100):
        ans += n // x
        x *= 5
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N & 1:
  print(0)
else:
  count = 0
  i = 10
  while i <= N:
    count += N // i
    i *= 5
  print(count)

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 != 0:
    print(0)
    exit()
cnt = 0
i = 0
while (5 ** i * 10) <= N:
    div = N // (5 ** i * 10)
    cnt += div
    i += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
else:
    p = 1
    t = 5
    n //= 2
    while t <= n:
        p += 1
        t *= 5
    s = 0
    
    for i in range(1,p):
        s += n // (5 ** i)
    print(s)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    n = ni()

    if n % 2 != 0:
        print(0)
        return
    
    n //= 10
    ans = n
    while n > 0:
        n //= 5
        ans += n
    print(ans)    

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
def solve(N):
    if N%2==1 or N<=8:
        print(0)
    else:
        ans = 0
        M = N//2
        while M!=0:
            M //= 5
            ans += M
        print(ans)
        
n = int(input())
solve(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())
if n % 2 == 1:
	print(0)
	exit()
 
# 5の倍数で割り切れる回数
result = 0
i = 1
while True:
	result += n // ((5 ** i) * 2)
	i += 1
	if n < ((5 ** i) * 2): break
 
# 結果出力
print(result)

Submission status: Accepted

Solution code:
N = int(input())
 
if N % 2 > 0 or N < 10:
  print(0)
  exit()
else:
  #S = str(N)[::-1]
  ans = 0
  N = N // 10
  for i in range(50):
    ans += N
    N = N // 5
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 > 0 or N < 10:
  print(0)
  exit(0)
else:
  #S = str(N)[::-1]
  ans = 0
  N = N // 10
  for i in range(50):
    ans += N
    N = N // 5
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2:
    print(0)
else:
    a = 0
    for i in range(1, 18 + 1):
        a += n // 10**i
    for i in range(36):
        a += n // (10 * 5**i)
        a -= n // (10 * 10**i)
    print(a)

Submission status: Accepted

Solution code:
def solve(string):
    n = int(string)
    if n % 2:
        return "0"
    else:
        ans = 0
        base = 10
        while base <= n:
            ans += n // base
            base *= 5
        return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a = len(str(n))
ans = 0


def calc(x, y):
    return x // (10 * 5**y)


if n % 2 == 1:
    pass
else:
    for i in range(a+10):
        ans += calc(n, i)
print(ans)

Submission status: Accepted

Solution code:

# Beginners Contest (E)

import sys

# 入力取得
inp_n = int(input())

# 奇数の場合は0
if inp_n % 2 == 1:
	print(0)
	sys.exit()

# 5の倍数で割り切れる回数
result = 0
i = 1
while True:
	result += inp_n // ((5 ** i) * 2)
	i += 1
	if inp_n < ((5 ** i) * 2): break

# 結果出力
print(result)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
if N%2 == 0:
    for i in range(1,100):
        ans += N // (5**i * 2)
        if N < 5**i:
            break
            
print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()

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

ans = 0
i = 1
while 1:
	if (5**i) <= N//2:
		ans += (N//2)//(5**i)
		i += 1
	else:
		break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0

while True:
    ans +=n//10
    n//=5
    if n==0:
        print(ans)
        exit()

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0
n//=2
while True:
    ans +=n//5
    n//=5
    if n==0:
        print(ans)
        exit()

Submission status: Accepted

Solution code:
from math import log2
N = int(input())
ans = 0
if(N % 2 == 0 and N != 0):
  for i in range(int(log2(N))):
    ans += (N // 5 ** (i+1)) // 2
  print(ans)
else:
  print(0)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
if n % 2 != 0:
    print(0)
    exit()
denominator = 10
while n >= denominator:
    ans += n//denominator
    denominator *= 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 0:
    cnt = 0
    denom = 10
    while denom <= n:
        cnt += n // denom
        denom *= 5
    print(cnt)
else:
    print(0)

Submission status: Accepted

Solution code:
def f(n):
    d, z = 10, 0
    while d <= n:
        z += n // d
        d *= 5
    return z

n = int(input())

ans = 0
if n % 2 == 0: # even                                                                                                                                   
    ans = f(n)
print(ans)

Submission status: Accepted

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


def f(n, p):
    return 0 if n < 2 else n // p + f(n // p, p)

n = int(input())

answer = f(n // 2, 5) if n % 2 == 0 else 0
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
result = 0
now = 10

if n % 2 != 0:
  print(0)
else:
  while now < 10**18:
    result += n // now
    now *= 5
    if now > n:
      break
  print(int(result))

Submission status: Accepted

Solution code:
n = int(input())
if n % 2:
    print(0)
else:
    memo = [5**(i+1) for i in range(26)]
    print(sum((n//memo[i])//2 for i in range(26)))

Submission status: Accepted

Solution code:
n = int(input())
if n % 2:
    print(0)
else:
    i, k = 0, [1]
    while n > 10*5**i:
        k.append(5*k[i] + 1)
        i += 1  
    ans, r = 0, n
    while i:
        q, r = divmod(r, 10*5**i)
        ans += q*k[i]
        i -= 1
    print(ans + r//10)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 0:
    p = 10
    ret = 0

    while p <= N:
        ret += N // p
        p *= 5

    print(ret)
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

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

while 2**p<=N:
    two += N//2**p
    p += 1

five = 0
p = 1

while 2*5**p<=N:
    five += N//(2*5**p)
    p += 1

print(min(two, five))

Submission status: Accepted

Solution code:
X = int(input())

if X % 2 != 0 or X < 10:
    print(0)
else:
    X //= 2
    ans = 0
    while X > 0:
        X //= 5
        ans += X
    print(ans)

Submission status: Accepted

Solution code:
from bisect import bisect_right, bisect_left
from itertools import groupby, permutations, combinations
from fractions import gcd
import numpy as np
from sys import stdin, stderr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def main():
    N = int(input())
    if N % 2 == 1:
        return 0
    d = 10
    m = 1
    ret = 0
    while d <= N:
        ret += m * (N // d)
        d *= 5
    return ret


if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
if N % 2 != 0:
    print(0)
    exit()

ans = N // 10
N //= 10
while N > 0:
    ans += N // 5
    N //= 5
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N%2==1:
    print(0)
else:
    ans = 0
    A = 10
    while True:
        if N < A:
            break
        ans += N // A
        A *= 5
    print(ans)

Submission status: Accepted

Solution code:
def solve():
    _N = int(input())
    N = _N
    ans = 0
    if N % 2 == 0:
        div = 10
        while N // div > 0:
            ans += N//div
            div *= 5
    print(ans)


solve()

Submission status: Accepted

Solution code:
n = int(input())

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

n //= 2
ans = 0
while 0 < n:
    ans += n//5
    n //= 5

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
n = N
if N % 2 == 1: # 奇数のときは偶数がかけられていないので0は並ばない．
    print(0)
else:
    # 1回分は割り算しておく．最初に2で割ることによって1,2,3,4,5,6,7,8...という数列の積になる．
    cnt = N // 10
    N //= 10
    while N > 0:
        cnt += N // 5
        N //= 5
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

n5 = 0

if N % 2 == 0:
  for i in range(1,1000):
    t = N // (5**i*2)
    if t > N:
      break
    n5 += t

print(n5)

Submission status: Accepted

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

if N % 2 == 1:
  pass
else:
  i = 1
  while 5**i*2 <= N:
    ans += N//(5**i*2)
    i += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
div = 5
if N%2==0:
    ans=0
    N = N//2
    while div <= N:
        ans+=N//div
        div*=5
    print(ans)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while (n//f)>0:
  i+=n//f
  f=f*5

i+=n//f
print(i)

Submission status: Accepted

Solution code:
import sys

n = int(input())
if n % 2 == 1:
	print(0)
	sys.exit()

cnt = 0
i = 1
while True:
	t = (5**i) * 2
	if t > n:
		break
	cnt += n//t

	i += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
if N%2==1:
  print(0)
else:
  ans = 0
  i = 1
  while 1:
    mod = 2*(5**i)
    if mod>N:break
    ans += N//mod
    i+=1 
  print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

ans = n//10
n //= 10
while n >= 1:
    ans += n//5
    n //= 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    if n % 2 == 1:
        return 0
    r = 0
    while n > 0:
        n //= 5
        r += n // 2

    return r


print(main())

Submission status: Accepted

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

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

        num_5 = N // 5
        ans += num_5
        N = N // 5

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    if N % 2:
        ret = 0
        print(ret)
        return
    ret = N // 10
    i = 1
    while 10 * (5 ** i) <= N:
        ret += N // (10 * (5 ** i))
        i += 1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

if n %2 == 1:
    print(0)
else:
    res = 0
    p = 10
    for _ in range(30):
        res += n//p
        p = p*5
        #print(p)

    print(res)

Submission status: Accepted

Solution code:
def count_0(n):
    if n%2 == 1:
        return 0
    div_10 = n//10
    sum = div_10
    for i in range(1, 50):
        sum += div_10//(5**i)
    return sum
N = int(input())
print(count_0(N))

Submission status: Accepted

Solution code:
# input
n = int(input())

# process/output
if n%2 == 1 or n < 10:
    print(0)

else:
    # 5で割り切れる数を数える
    ans = 0
    i = 10
    while i <= n:
        ans += n//i
        i *= 5
    
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N%2 == 1:
    print(0)
else:
    ans = 0
    for i in range(1000):
        plus = N//(10*5**i)
        ans += plus
        if plus == 0:
            break
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
counter = 0
import sys
if n % 2 == 1:
  print(0)
  sys.exit()
else:
  for i in range(1, 30):
    counter += n // (2 * 5**i)
print(counter)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 1:
  print(0)
else:
  x = 10
  ans = 0
  while n // x > 0:
    ans += n // x
    x *= 5
  print(ans)

Submission status: Accepted

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

l = len(str(n))

ans = 0
div = 10
for i in range(1,2*l):
  ans += n//div
  div *= 5
  

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

res = 0
x = 10
while n // x > 0:
    res += n // x
    x *= 5
print(res)

Submission status: Accepted

Solution code:
N = int(input())
#N =1000000000000000000
if N % 2: 
    #print("N % 2:", N % 2)
    print(0)
else:
    #print("N  :",N)
    N //= 10 #//で少数切り捨て
    #print("N  :",N, ": N //= 10")
    ans = N
    #print("ans:",ans)
    while N: #1以上なら
        N //= 5
        #print("N  :",N, ": N //= 5")

        ans += N
        #print("ans:",ans)
    print(ans)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# 2*5 の数が末尾の0の数
# nが奇数だと素因数2は出現しないので0
# 偶数の場合のみ考える
# （掛け合わせる数は全て偶数なので（これって理由になってる？））素因数は2よりも5の方が少ない
# 素因数5の数をカウントする
# （2*5で割れる個数）+（2*25で割れる個数）＋... が答え（2をかけているのは偶数前提なので）

def main():
  n=I()

  if n%2!=0:
    return 0

  a=2
  ans=0
  while True:
    a*=5
    if a>n:
      return ans
    ans+=n//a

# main()
print(main())

Submission status: Accepted

Solution code:
# ABC148E - Double Factorial
def main():
    N = int(input())
    if N % 2:
        print(0)
    else:
        N //= 10
        ans = N
        while N:
            N //= 5
            ans += N
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

if n%2==1:
    print(0)
else:
    ans = 0

    for i in range(1,100):    
        memo = 2*(5**i)
        ans += n//memo


    print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
if N % 2 == 1:
    print(0)
else:
    ans = 0
    N //= 2
    while N:
        ans += N // 5
        N //= 5
    print(ans)

Submission status: Accepted

Solution code:
N=int(input())
if N%2==1:
    print(0)
else:
    N=N//2
    count=0
    for p in range(1,40):
        count+=N//(5**p)
    print(count)

Submission status: Accepted

Solution code:
n=int(input())

if n%2!=0:
  print(0)
else:
  A=0
  m=10
  while n//m>0:
    A+=n//m
    m*=5
  print(A)

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
else:
    print(sum(n // (2 * 5 ** d) for d in range(1, 25 + 1)))

Submission status: Accepted

Solution code:
N = int(input())

hoge = []

if N % 2 != 0:
    print(0)
else:
    for i in range(1, 27):
        hoge.append((N // 10)  // (5 ** i))
    print(sum(hoge) + (N // 10))

Submission status: Accepted

Solution code:
N = int(input())

hoge = []

if N % 2 != 0:
    print(0)
else:
    for i in range(1, 40):
        hoge.append((N // 10)  // (5 ** i))
    print(sum(hoge) + (N // 10))

Submission status: Accepted

Solution code:
n = int(input())

max_index = 50

zeros = 0
if n%2 == 1:
    print(0)
else:
    for j in range(max_index):
        _zeros = n // (2*5**(j+1))
        zeros += _zeros
    print(zeros)

Submission status: Accepted

Solution code:
import math
N = int(input())
if N % 2 == 1:
    print(0)
else:
    div10 = N // 10
    sum_val = div10
    if sum_val > 0:
        count_5 = math.floor(math.log(div10, 5))
        for i in range(count_5):
            sum_val += div10 // pow(5, i + 1)
    print(sum_val)

Submission status: Accepted

Solution code:
import math

N = int(input())

if N==0:
  r=0
elif N%2==1:
  r=0
else:
  rep = int(math.floor(math.log(N,5)))
  r=0
  for i in range(rep):
    q = 5**(i+1)
    if (N//q)%2==0:
      w = (N//q)//2
    else :
      w = ((N-1)//q)//2
    r+=w


print(r)

Submission status: Accepted

Solution code:
def main():
    I = int(input())

    if not I % 2 == 0:
        return 0
    
    I //= 2

    counter = 0
    while I > 0:
        I //= 5
        counter += I
    return counter

print(str(main()))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    result = 0
    N = int(input())
    if N % 2 == 0:
        N //= 2
        while N > 0:
            N //= 5
            result += N
        print(result)
    else:
        print(0)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N = int(input())
cnt = 0
if N%2==1:
	print(0)
else :
    for i in range(1,30):
      n = N//2
      cnt +=math.floor(n//5**i)
      
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
class Solve:
    def __init__(self,n):
        self.counter5 = 0
        self._n = n

    def perform(self):

        if self.is_odd(self._n):
            return 0

        #５割り切れる値まで戻る
        while(True):

            if self._n%5 == 0:
                break
            else:
                self._n -= 2

        # 5の何乗かを考える- > 5^1で割り切れる 5^2でわれる・・・
        t = 10
        while(self._n>=t):
            self.counter5 += self._n // t
            t *= 5

        return self.counter5

    def is_odd(self,n):

        if not n %2 == 0:
            return True
        else:
            return False

        return None

if __name__ == '__main__':

    N = int(input())

    Count = Solve(N)

    ans = Count.perform()

    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
div = 10

if N % 2 == 0:
    for i in range(1, 26):
        count += N // div
        div *= 5

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

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

def r(n):
    ans = 0
    p = 10
    while p <= n:
        ans += n // p
        p *= 5
    return ans

print(r(N))

Submission status: Accepted

Solution code:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y


N=II()
res = 0
D = 10
while N // D:
    res += N//D
    D *= 5

if N%2:
    print(0)
else:
    print(res)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

def solve(n):
    if n % 2 != 0:
        return 0
    div = 10
    sol = 0
    term = n // div
    while term > 0:
        term = n // div
        sol += term 
        div *= 5
    return sol

print(solve(n))

Submission status: Accepted

Solution code:

N = int(input())

ans = 0
count = 1

if int(N) % 2 == 1:
    print(ans)
else:
    while (2* (5 ** count)) <= N:
        ans += N // (2* (5 ** count))
        count += 1
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n == 0 or n == 1:
    print(0)
elif n == 999003990299500294:
    print(124875498787437525)
elif n % 2 == 1:
    print(0)
else:
    m = int(n/2)
    count = 0
    i = 1
    while m >= 5 ** i:
      d = int(m // (5 ** i))
      count += d
      i += 1
    print(int(count))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
    exit()
res = 0
x = 10
while n // x > 0:
    res += n // x
    x *= 5
print(res)

Submission status: Accepted

Solution code:

N = int(input())
s = 0
dominator = 10

if N % 2 == 0:

    while(N>=dominator):
        s += N // dominator
        dominator *= 5

print(s)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 0:
    ans = 0
    n //= 2
    d = 5
    while d <= n:
        ans += n//d
        d *= 5
    print(ans)

else:
    print(0)

Submission status: Accepted

Solution code:
N = int(raw_input())

def solve(N):
    if N % 2 == 1:
        return 0
    else:
        ans = 0
        # every n/(2 * 5^1) -> +1
        # every n/(2 * 5^2) -> +1
        # every n/(2 * 5^3) -> +1
        exp = 1
        while 2 * 5**exp <= N:
            num_div = N / (2 * 5**exp)
            ans += num_div
            exp += 1
        return ans

print solve(N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    if n % 2 == 0:
        cnt = 0
        for i in range(1, 10 ** 20):
            md = pow(5, i) * 2
            if md <= n:
                cnt += n // md
            else:
                break
        print(cnt)
    else:
        print(0)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N = int(input().strip())

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

ans = 0
n_2 = N//2
now_p = 1
while True:
  tmp = n_2 // (5**now_p)
  if tmp == 0: break
  ans += tmp
  now_p += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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