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(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N):
    if N % 2 == 1:
        print(0)
        return
    n = 10
    ans = 0
    while n <= N:
        ans += N // n
        n *= 5
    print(ans)


if __name__ == '__main__':
    N = int(input())
    solve(N)

    # # test
    # from random import randint
    # from func import random_str
    # solve()

Submission status: Accepted

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

  if N%2:
    print(0)
    return True
  multiplier = 10
  result = 0
  while multiplier <= N:
    result += N // multiplier
    multiplier *= 5

  print(result)

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input());a=10;b=0
if N&1==0:
    while a<=N:b+=N//a;a*=5
print(b)

Submission status: Accepted

Solution code:
import math
from typing import List, Counter, Tuple
from collections import Counter
from itertools import permutations, zip_longest, groupby


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> int:
    # f(n) = 1, n < 2
    # f(n) = n*f(n-2) n>= 2
    N = read_int()
    if N%2 == 1:
        return 0
    answer = 0
    base = 10
    while base <= N:
        answer += N//base
        base *= 5
    return answer


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 0:
    answer = 0
    N //= 2
    for i in range(100):
        answer += N // 5
        N //= 5
    print(answer)
else:
    print('0')

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


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

    ans = 0
    cnt = 10
    while True:
        ans += n//cnt
        cnt *= 5
        if cnt > n:
            break
    print(ans)



if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    if N%2==1:
        print(0)
        exit()
    
    ans=0
    
    for i in range(1,100):
        a=2*pow(5,i)
        ans+=N//a
        
    print(ans)
        
    
    

main()

Submission status: Accepted

Solution code:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

ketasu = len(str(n))

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

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

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

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

Submission status: Accepted

Solution code:
import sys
N = int(input())
if N %2 !=0:
    print(0)
    sys.exit()
else:
    sum = 0
    num = N
    num_tmp = num //5
    while num_tmp > 0:
        num_tmp = num // 5
        sum += num // 10
        num = num_tmp
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve(n):
    if n % 2 != 0:
        return 0

    total = 0
    now = 5
    while now <= n:
        total += n // (now * 2)
        now *= 5

    return total


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

if N % 2 or N < 10:
  print(0)
  exit()
  
ans = 0
i = 1
while 2*5**i<=N:
  ans += N // (2*5**i)
  i += 1
  
print(ans)

Submission status: Accepted

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

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

ans = 0
N //= 2
i = 1
while N >= 5 ** i:
    ans += (N // 5 ** i)
    i += 1

print(ans)

Submission status: Accepted

Solution code:
# import itertools
# import math
import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     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

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

tot = 0
i = 10
while(N >= i):
    tot += N // i
    i *= 5
print(tot)

Submission status: Accepted

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) if N % 2 == 0 else 0)

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  if n%2==1 or n<10:
    return 0

  st=10
  ans=[]
  while st<=n:
    ans.append(n//st)
    st*=5

  return sum(ans)

# main()
print(main())

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 0:
    tmp = 10
    ans = 0
    while tmp <= N:
        ans += N // tmp
        tmp = 5 * tmp

    print(ans)
 
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-09-03 17:51
# @url:https://atcoder.jp/contests/abc148/tasks/abc148_e
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
from decimal import *
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
def main():
    # refer:
    # https://blog.csdn.net/qq_43765333/article/details/103658132?utm_medium=distribute.pc_feed_404.none-task-blog-BlogCommendFromBaidu-2.nonecase&depth_1-utm_source=distribute.pc_feed_404.none-task-blog-BlogCommendFromBaidu-2.nonecas
    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)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 0:
    Ans = 0
    p = 1
    check = 0
    while check != 0 or p == 1:
        check = N // (2 * 5**p)
        Ans += check
        p += 1
    print(Ans)

else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math

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

count_2 = 0
count_5 = 0
deno = 2
while deno <= N:
    count_2 += N // deno
    deno *= 2

deno = 10
while deno <= N:
    count_5 += N // deno
    deno *= 5

print(min(count_2, count_5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

if N%2 or N<10:
  print(0)
else:
  cnt,n=0,1
  while n<=N:
    cnt+=N//(10*(n))
    n*=5
  print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:
    ans = 0
else:
    div2 = N // 2
    n = N // 2
    k = 1
    while n // 2**k > 0:
        div2 += n // 2**k
        k += 1

    div5 = 0
    n = N // 2
    k = 1
    while n // 5**k > 0:
        div5 += n // 5**k
        k += 1
    
    ans = min(div2, div5)

print(ans)

Submission status: Accepted

Solution code:
import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

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

def Main():
    n = read_int()
    if n % 2:
        print(0)
        sys.exit()

    ans = 0
    n //= 2
    while n >= 5:
        n //= 5
        ans += n
    print(ans)

if __name__ == '__main__':
    Main()

Submission status: Accepted

Solution code:
n = input()
m = len(n)
n = int(n)
if n%2==1:
    print(0)
else:
    if m==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: Accepted

Solution code:
n=input()
m=len(n)
n=int(n)

if n%2==1:
    print(0)
else:
    if m==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: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import math
from decimal import *

def cnt_prime(p, n):
    div = Decimal(str(n))
    s = 0

    while True:
        div /= p
        if div < 1:
            break
        if p == 2:
            s += int(div.quantize(Decimal('0.0'), rounding=ROUND_FLOOR))
        else:
            s += int(div.quantize(Decimal('0.0'), rounding=ROUND_FLOOR)) // 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: Accepted

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

Submission status: Accepted

Solution code:
#まずnが奇数なら値は0
#nが偶数なら素因数5の個数
#素因数10の個数を求めたい
n=int(input())
if n%2==1:
  print(0)
else:
  ans=0
  num=5
  n=n//2
  while num<=n:
    ans+=n//num
    num=num*5
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n%2:print(0);exit()
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: Accepted

Solution code:
import sys
sys.setrecursionlimit(2000)

def check_2(num):
    if num % 2 != 0:
        return 0
    return check_2(num // 2) + 1


def check_5(num):
    if num % 5 != 0:
        return 0
    return check_5(num // 5) + 1


def f_2(num):
    if num < 2:
        return 0
    return f_2(num - 2) + check_2(num)


def f_5(num):
    if num < 5:
        return 0
    return f_5(num - 2) + check_5(num)


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 0:
    n5 = 1
    y = 10
    c = []

    while y <= n:
        c.append(n//y)
        if len(c) > 1:
            c[-2] -= c[-1]
        y *= 5

    cnt = 0
    for i in range(len(c)):
        cnt += c[i]*(i+1)

    print(cnt)
else:
    print(0)

Submission status: Accepted

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

Solution code:
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def main():
    n = II()
    if n % 2 == 1:
        print(0)
        return

    n_int = n // 2
    ans_int = 0

    k = 5
    while k <= n_int:
        ans_int += n_int//k
        k *= 5

    print(ans_int)


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n<=4:
  print(0)
  exit()
  
if n%2==1:
  print(0)
  exit()
  
cnt=10
ans=0

for i in range(100):
  ans+=n//cnt
  cnt*=5
  
  
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:

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

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

    ans = 0
    tmp = N // 2
    while tmp:
        tmp //= 5
        ans += tmp
    print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

n = int(input())

def g1(n, p): 
    ''' 
    How many times can n! be divided by p?
    '''
    if n == 0:
        return 0
    return n//p + g1(n//p, p)

def g2(n, p): 
    ''' 
    How many times can n!! be divided by p?
    '''
    if n%2 == 1:
        return g1(n, p) - g2(n-1, p)

    res = g1(n//2, p)
    if p == 2:  
        res += n//2
    return res 

ans = min(g2(n, 5), g2(n, 2)) 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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//(2*(5**i))

print(ans)

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()

ans = 0
if n % 2 == 1:
    ans = 0
else:
    div = 10
    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
x = 1
while n > 5**x:
    cnt += n//5**x//2
    x += 1
print(cnt)

Submission status: Accepted

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 , 5) )

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if n%2 == 0:
    while n//(2*(5**i)) > 0:
        cnt += n//(2*(5**i))
        i +=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

while n >= 5:
    n //= 5
    ans += n
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

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

    count = []
    i = 0
    while True:
        q = N // (10 * 5 ** i)
        if q == 0:
            break
        else:
            count.append((q, i + 1))
            i += 1

    ans = 0
    prev_c = 0
    for c, n_zero in count[::-1]:
        ans += n_zero * (c - prev_c)
        prev_c = c

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
    exit()
#### n is even ####
ans = 0
cnt = 0
ones = 0
keta = []
cnt = 5 * 2
while n >= cnt:
    ans += n // cnt
    cnt *= 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def fac1(num, div):
    """How many times can the factorial of `num` be divided by `div`?"""
    if num == 0:
        return 0
    return num // div + fac1(num // div, div)


def fac2(num, div):
    """How many times can the double factorial of `num` be divided by `div`?"""
    return fac1(num // 2, div)


def main():
    num = int(input())
    if num % 2 == 1:
        return 0
    else:
        return fac2(num, 5)


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

Submission status: Accepted

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

import sys
from math import factorial
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


N = int(input())

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


div = 10
count = 0
while N // div:
    count += N // div
    div *= 5


print(count)

Submission status: Accepted

Solution code:
N=int(input())

if N%2:
    print(0)
else:
    X=0
    Y=N//5
    while Y:
        X+=Y//2
        Y//=5
    print(X)

Submission status: Accepted

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

if N%2 ==1:
    out=0

else:
    k=5
    while k<10**18:
        out+= (N//k)//2
        k*=5

print(out)

Submission status: Accepted

Solution code:
def calculate(n):
    if n % 2 == 1:
        return 0
    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: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
 
def main():
    n=int(input())
    if n%2==1:
        print(0)
    else:
        m=n//2
        ans=0
        for i in range(1,30):
            ans+=m//(5**i)
        print(ans)

 
if __name__=='__main__':
    main()