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:
n = int(input())
if n % 2 ==0:
    count = 0
    p = 1
    while n >= pow(5, p):
        count += n // (2 *pow(5, p))
        p += 1
    print(count)
else:
    print(0)

Submission status: Accepted

Solution code:
l = [
 5,
 25,
 125,
 625,
 3125,
 15625,
 78125,
 390625,
 1953125,
 9765625,
 48828125,
 244140625,
 1220703125,
 6103515625,
 30517578125,
 152587890625,
 762939453125,
 3814697265625,
 19073486328125,
 95367431640625,
 476837158203125,
 2384185791015625,
 11920928955078125,
 59604644775390625,
 298023223876953125,
 1490116119384765625,
 7450580596923828125]
a = int(input())
res = 0
for i in l:
    res+= (a//i)//2
if a%2==1 or a<10:
    print(0)
else:
    print(res)

Submission status: Accepted

Solution code:
N = int(input())

divs = [5**i for i in range(1, 31)]
if N % 2 == 1:
    print(0)
else:
    ans = 0
    for div in divs:
        ans += N // div // 2
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

    cnt = 0
    d = 10
    c = 1
    while d <= N:
        m = N//d 
        cnt += c*m
        d *= 5

    print(cnt)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


def log(k, b):
    a = 0
    while b ** a <= k:
        a += 1
    return a - 1



N = int(input())
if N % 2 == 1:
    print(0)
else:
    k = N // 2
    a = log(k, 5)
    ans = 0
    for i in range(1, a + 1):
        ans += k // (5 ** i)
    print(ans)

Submission status: Accepted

Solution code:
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
if n%2 == 1:
    print(0)
    exit()
m = n//2
x = 0
for i in range(1,30):
    x += m//(5**i)
print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
N = int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    N //= 2
    while N >= 5:
        ans += N//5
        N = N //5
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    if N % 2 != 0:
        print(0)
        return
    i = 1
    f2 = 0
    while (2 ** i) <= N:
        f2 += (N // (2 ** i))
        i += 1
    i = 1
    f5 = 0
    while (5 ** i) * 2 <= N:
        f5 += (N // ((5 ** i) * 2))
        i += 1
    print(min(f2, f5))


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1 or n==0 or n==1:
  print(0)
else:
  l=n//2
  k=0
  while l>=5:
    l/=5
    k+=1
  c=0
  for i in range(1,k+1):
    c+=n//(2*5**i)
  print(c)

Submission status: Accepted

Solution code:
n = int(input())

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

num = n // 2
dv = 5
ans = 0
while dv <= 10 ** 18:
    ans += num // dv
    dv *= 5

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

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

print(ret)

Submission status: Accepted

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

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


N=N//2
retval=0
i=1
while 5**i<=N:
    retval+= N//(5**i)
    i+=1

print(retval)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True
#for i in range(n):

ans=0

def f(n):
    if n<2:
        return 1
    return n*f(n-2)

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


def g(n,k):
    
    '''
    k=-1
    for i in range(30):
        if 5**i<=n:
            k=i
    '''
    return n//(5**(k))-n//(5**(k+1))

n=n//2

for i in range(1,30):
    #show((n,i),g(n,i))
    ans+=g(n,i)*i

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n%2:
    print(0)
else:
    ans = 0
    base = 10
    while base<=n:
        ans+=n//base
        base*=10
    five = 50
    while five<=n:
        tmp = five+0
        while  tmp<= n:
            ans += n//tmp - n//(tmp*2)
            tmp *= 10
        five*=5
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:
  print(0)
else:
  fives = 0
  twos = 0
  f = 10
  while (N // f != 0):
    fives += N // f
    f = f * 5
  t = 2
  while (N // t != 0):
    twos += N // t
    t = t * 2
  print(min(fives, twos))

Submission status: Accepted

Solution code:
n = int(input())
if n%2:
  print(0)
else:
  t = n//2
  c2, c5 = t, 0
  l = t
  while t>0:
    t //= 2
    c2 += t
  while l>0:
    l //= 5
    c5 += l
  print(min(c2, c5))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

ans = 0

if N % 2:
    ans = 0
else:
    n = N // 10

    while n > 0:
        ans += n
        n = n // 5

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

for i in range(1, 100):
    two += N//2**i

for i in range(1, 100):
    five += N//(2*5**i)

print(min(two, five))

Submission status: Accepted

Solution code:
N = int(input())
# 二重階乗
if N % 2 == 1:
    print(0)
    exit()
# 単純に5の素因数数を数えたので事足りる?
ans = N // 10
for i in range(2,30):
    m = 10**i//2**(i-1)
    ans += N // m 
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

if n != 0 and n % 2 == 0:
    m = n //2
    while (m > 0):
        m = m // 5
        ans += m

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 1:
    out = 0
else:
    n2 = n // 2
    tmp5 = 5
    out = 0
    while tmp5 <= n2:
        out += (n2 // tmp5)
        tmp5 *= 5

print(out)

Submission status: Accepted

Solution code:
N = int(input())
if((N == 0)or(N%2 == 1)):
  ans = 0
else:
  ans = 0
  for i in range(1,26+1):
    p = 5**i
    n = N//2
    ans += n//p
print(ans)

Submission status: Accepted

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict
from fractions import gcd
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	if N % 2 == 0:
		D = defaultdict(int)
		n = int(N // 2)
		D[2] += n
		for i in range(1, 42):
			D[2] += int(n // (2 ** i))
		for i in range(1, 42):
			D[5] += int(n // (5 ** i))
		print(min(D[2], D[5]))

	else:
		print(0)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
N = int(input())
if N%2 == 1:
    print(0)
else:
    N = N//2
    kn = 0
    for i in range(26):
        i += 1
        kn += N//(5**i)
    print(kn)

Submission status: Accepted

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	n = int(input())
	i = 10
	ans = 0
	while i <= n:
		ans += n//i
		i*=5
	print(ans if n%2==0 else 0)

def factorization(n):
	if n<2:
		return []
	arr = []
	temp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp //= i
			arr.append([i, cnt])

	if temp!=1:
		arr.append([temp, 1])

	if arr==[]:
		arr.append([n, 1])

	return arr

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

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)
	if(out == ''): return '0'
	return out

def gcd(numbers):
	return reduce(fractions.gcd, numbers)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from fractions import *

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

Submission status: Accepted

Solution code:
#import numpy as np
def cin():
    return map(int, input().split())


n = int(input())

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

div = 1
n //= 2

for i in range(33):
    div *= 5
    cnt += n // div

print(cnt)

Submission status: Accepted

Solution code:
def inpl():
    return list(map(int, input().split()))


def solve(N, m=5):
    tmp = (N // m) // 2
    if tmp > 0:
        t = solve(N, m * 5)
        return tmp + t
    else:
        return 0


N = int(input())

if N % 2 == 1:
    print(0)
else:
    print(solve(N))

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    if N&1:
        print(0)
        return
    ans = 0
    for ex in range(1,26):
        ans += (N//(5**ex))//2
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
if n % 2 == 1:
    print(0)
    import sys
    sys.exit()
else:
    while n:
        ans += n // 10
        n //= 5

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:
  print(0)
else:
  a = 0
  '''for i in range(1, 19):
    a += N // (10**i)'''
  j = 1
  b = 1
  while b > 0:
    b = N // ((5 ** j) * 2)
    j += 1
    a += b
  print(a)

Submission status: Accepted

Solution code:
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())


def test():
    ret = 1
    for i in range(2, N + 1, 2):
        ret *= i
    r = 0
    while ret % 10 == 0:
        ret //= 10
        r += 1
    print(r)


def count(c):
    # n 以下の c の倍数が何個あるか
    return N // c


if N & 1:
    print(0)
    exit()
# n 以下の偶数の総乗
ans = 0
c = 10
while c <= N:
    ans += count(c)
    c *= 5
print(ans)

Submission status: Accepted

Solution code:
import sys, fractions
def input():
    return sys.stdin.readline()[:-1]
N = int(input())

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

ans = 0
for i in range(1,30):
    k = (5**i)*2
    if k>N:
        break
    ans += N//k
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 0 :
  ret = 0
  x = 10
  for _ in range(1, 40) :
    ret += N // x
    x *= 5
    
  print(ret)
else :
  print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    if N % 2 == 1:
        return 0

    n = N // 2
    i = 5
    ans = 0
    while i <= n:
        ans += n // i
        i *= 5
    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())

ans=0
if(n<=2 or n%2==1):
    ans=0
else:
    temp=n//10
    ans+=temp
    for i in range(100):
        temp//=5
        ans+=temp
        if(temp==0):
            break


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
m = 10
while True:
    count += N // m
    m *= 5
    if N // m == 0:
        break

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
if N % 2:
  print(0)
  exit(0)
res = 0
while N // 5:
  res += N // 10
  N //= 5
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""

N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=int(input())
    if n%2:
        print(0)
        exit()
    ans=0
    d=10
    for _ in range(26):
        ans+=n//d
        d*=5
    print(ans)

main()

Submission status: Accepted

Solution code:
n = int(input())

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

l = []
for i in range(30, 0, -1):
    l.append(2 * (5**i))

here = 0
for i in range(1, len(l)):
    here += (n//l[i] - n//l[i-1]) * (len(l) - i)

print(here)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

if N%2 == 1:
    print(0)
else:
    M = N//2
    count = 0
    denom = 5
    while True:
        count += M//denom
        denom = denom*5
        if denom > M:
            break
    print(count)

Submission status: Accepted

Solution code:
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def bitlist(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

#a = list(map(int, input().split()))

m = int(input())
n = m//2
flag2 = m%2

num2=0
num5=0
ans2=1
ans5=1

while(True):
    if(ans2 > n):
       break
    num2 += 1
    ans2 *= 2
    
while(True):
    if(ans5 > n):
       break
    num5 += 1
    ans5 *= 5   

have2 = 0
have5 = 0
#print(num2,num5)
now2 = num2
for i in range(num2):
    times = n // int(2**now2)
    have2 += times
    now2 -=1
    #print("t",times)

now5 = num5
for i in range(num5):
    times = n // int(5**now5)
    have5 += times
    now5 -=1
    
#print(have2+n,have5,flag2)

if(flag2==0):
    print(min(have2+n,have5))
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0
d = 2 * 5
for i in range(40):
    ans += N // d
    d *= 5
print(ans)

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
if n%2==1:
    print(0)
    quit()
tmp=n
waru=10
li=[]
while tmp//waru>0:
    li.append(tmp//waru)
    waru*=5
ans=0
# for i in range(len(li)):
#     ans+=li[i]
print(sum(li))
# print(li)

Submission status: Accepted

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

k = 1
ans = 0
while True:
    n = N//(2*(5**k))
    if n==0: break
    ans += n
    k +=1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
minans = inf ;ans = 0 ;count = 0 ;pro = 1



n=int(input())
if n%2==1:
    print(0)
    exit()
k=10
for i in range(1,100):
    count+=n//(k)
    k*=5
print(count)

Submission status: Accepted

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

ans = 0
a = 5
while N > a:
	ans += N // (a*2)
	a *= 5
print(ans)

Submission status: Accepted

Solution code:
import sys

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

ans=0

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

Submission status: Accepted

Solution code:
n = int(input())

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

count2 = 0
num = 2
while num <= n:
    count2 += n // num
    num *= 2

count5 = 0
num = 10
while num <= n:
    count5 += n // num
    num *= 5

print(min(count2, count5))

Submission status: Accepted

Solution code:
n = int(input())
if n%2 == 1:
  print(0)
  exit()
k = n//2
count = 0
i = 1
x = k
while True:
  x = x//5
  if x > 0:
    count += x
  else:
    break
print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

d = 1
ans = 0
n //= 2
while n >= 5:
    ans += (n // 5)# * d
    n //= 5

print(ans)

Submission status: Accepted

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

n //= 2

p, cnt = 5, 0

while n >= p:
    cnt += n // p
    p *= 5
    
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

if N%2 == 1:
    print(0)
else:
    N //= 2
    a = 0
    q = 5
    while q <= N:
        a += N//q
        q *= 5
    print(a)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n%2!=0:
    print(0)
else:
    a=0
    b=0
    n=n//2
    import math
    for i in range(1,100):
        a+=n//(5**i)
    n=n*2
    for j in range(1,100):
        b+=n//(2**j)
    print(min(a,b))

Submission status: Accepted

Solution code:
#coding: utf-8

import sys

N = int(sys.stdin.readline().rstrip())

if N % 2 != 0:
	print(0)
else:
	two = 0
	enu = N
	while enu > 0:
		enu //= 2
		two += enu
	five = 0
	enu = N // 2
	while enu > 0:
		enu //= 5
		five += enu
	answer = two
	if five < answer:
		answer = five
	print(answer)

"""
Nが奇数のとき → 素因数に2が含まれない
→ 2ずつ引いていっても素因数に2が含まれない
→ 答えは0

Nが偶数のとき → 素因数に2はいっぱい含まれる
2の倍数 → 2が1個
4の倍数 → 2がもう1個
8の倍数 → 2がさらに1個
…

5についても同様に求める
ただし、奇数はカウントしない
"""

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def f(n):
    if n < 2:
        return 1
    
    return n * f(n - 2)


def main():
    N = int(input())
    if N % 2 == 1:
        print(0)
        return

    N //= 2
    res = 0
    while N > 0:
        N //= 5
        res += N
    print(res)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

else:
    m = n // 2
    ans = 0
    div = 5
    while (m // div) > 0:
        ans += m // div
        div *= 5
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N%2==1:
  print(0)
else:
  ans = 0
  m = 5
  n = 1
  while m<=N:
    c = N//m
    c = c//2
    ans += c
    m *= 5
  print(ans)

Submission status: Accepted

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

ans = 0
c = 1

while True:
    ans += (n // (5 ** c))//2
    c += 1
    if n // (5 ** c) == 0:
        break

anss = 0


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()

def df(n):
    if(n<2): return 1
    return n*df(n-2)

def resolve():
    n=int(input())

    # 奇数のときは 0
    if(n&1):
        print(0)
        return

    # n が小さいときは愚直にやる
    if(n<=100):
        x=df(n)
        ans=0
        while(x%10==0):
            ans+=1
            x//=10
        print(ans)
        return

    # そうでなければ n 偶数に対して 10 の倍数を調べる
    ans=0
    while(n):
        ans+=n//10
        n//=5
    print(ans)

resolve()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    if N % 2 == 1:
        print(0)
        return
    # N = 2k
    N //= 2
    d = 5
    res = 0
    while True:
        if N < d:
            break
        res += N // d
        d *= 5
    print(res)
main()

Submission status: Accepted

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

Submission status: Accepted

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