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:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
def f(n):
    if n < 2:
        return 1
    else:
        return n * f(n - 2)

"""
2,5が大事
11 > 9 > 7 > 5 > 3 > 1

10 > 8 > 6 > 4 > 2 > 1
10の個数

というより5の倍数をどう数えるかが重要．
まず10でぜんたいを割って10による部分をansにたす．
その後，5の倍数を取り出す．
"""
if N % 2 == 1:
    print("0")
    sys.exit()

# base_ans = 0
# fn = str(f(N))
# while True:
#     if len(fn) < 1:
#         break
#     if fn[-1] == "0":
#         base_ans += 1
#         fn = fn[:-1]
#     else:
#         break
# print(base_ans)

ans = 0
if N >= 10:
    N //= 10
    ans += N

n = copy.deepcopy(N)
while n > 4:
    n //= 5
    ans += n

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:
    print(0)
else:
    cnt = 0
    div = 10
    for _ in range(100):
        cnt += N // div
        div *= 5
    print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
def f(n):
    if n < 2:
        return 1
    else:
        return n * f(n - 2)

"""
2,5が大事
11 > 9 > 7 > 5 > 3 > 1

10 > 8 > 6 > 4 > 2 > 1
10の個数
"""
if N % 2 == 1:
    print("0")
    sys.exit()

# base_ans = 0
# fn = str(f(N))
# while True:
#     if len(fn) < 1:
#         break
#     if fn[-1] == "0":
#         base_ans += 1
#         fn = fn[:-1]
#     else:
#         break
# print(base_ans)

ans = 0
if N >= 10:
    N //= 10
    ans += N

n = copy.deepcopy(N)
while n > 4:
    n //= 5
    ans += n
# 5の倍数
# if N // 50 % 2 == 0:
#     ans += N // 50 // 2 - 1
# else:
#     ans += math.ceil(N // 50 / 2)

# N //= 10
# tmp = 2
# while True:
#     # print(tmp)
#     if N < 5 ** tmp:
#         break
#     ans += N // (5 ** tmp)
#     tmp += 1



print(ans)

Submission status: Accepted

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

# Nが奇数の場合は-2していくと全て奇数になるので答えは0
# Nが偶数の場合を検討するべし
# Nが偶数の場合、明らかに2の倍数より5の倍数の方が少ないので5の倍数がいくつかで考える
if (N % 2 == 1):
    print(0)
    exit()

bunbo = 0
sum_5 = 0
while (10 * 5 ** bunbo) <= N:
    sum_5 += N // (10 * 5**bunbo)
    bunbo += 1

print(sum_5)

Submission status: Accepted

Solution code:
import sys
#input = sys.stdin.buffer.readline
N = int(input())
temp = 5
ans = 0
if N%2:
    print(0)
    quit()
else:
    N = N//2
    while temp <= N:
        ans += N//temp
        temp *= 5
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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=int(input())
if n%2: print(0)
else:
    s=0
    x=10
    while n//x:
        s+=n//x
        x*=5
    print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = input()

def f(x):
  p = 1
  i = 1
  cnt = 0
  while p > 0:
    p = x // (5**i) // 2
    cnt += p
    i += 1
  return cnt

if int(N[-1])%2 == 1:
  print(0)
else:
  print(f(int(N)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
def main():
    n = int(input())
    if n <= 9 or n % 2 == 1:
        print(0)
        sys.exit()

    n5 = 5
    r = 0
    while n >= n5 * 2:
        r += n // (n5 * 2)
        n5 *= 5
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
tmp = 10
ans = 0

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

Submission status: Accepted

Solution code:
N = int(input())

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

else:
    fives = 0
    power = 0

    while (5 ** (power+1)) <= N:  # Nには5のpower乗まで入る
        power += 1

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

    print(int(fives))

Submission status: Accepted

Solution code:
n = int(input())
if n%2:
    print(0)
else:
    #2と5があれば10ができる→5の方が少ない→素因数5の数を数える
    ans = (n//5)//2
    tmp = 5
    while True:
        tmp *= 5
        if tmp > n:
            break
        ans += (n//tmp)//2
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    if N % 2:
        print(0)
        return

    N //= 10
    ans = N
    while N:
        N //= 5
        ans += N

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    if N % 2:
        print(0)
        return

    ans = N // 10
    p = 50
    while True:
        tmp = N // p
        if tmp == 0:
            break
        ans += tmp
        p *= 5

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def readinput():
    n=int(input())
    return n

def main(n):
    if n%2==1:
        return 0
    
    n=n//2
    count=0
    base=5
    while(base<=n):
        count+=n//base
        base*=5
    return count

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    N = input()

    res = 0
    if int(str(N)[-1]) % 2 == 0:
        i = 0
        N=int(N)
        while int(N) >= 2*5**i:
            i += 1
            res += N//(2*5**i)

    print(res)



if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n=int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
if n >= 2 and n % 2 == 0:
    j = 10
    while n >= j:
        ans += (n // j)
        j *= 5

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

ans=N//10
cur=N//10
while cur//5>0:
    cur//=5
    ans+=cur


print(ans)

Submission status: Accepted

Solution code:
# v=[]
# num=251
# for i in range(num):
#     if i==0 or i==1:
#         v.append(1)
#     else:
#         v.append(i*v[i-2])
        
# for i in range(0,num,2):
#     print(i,v[i],end=' ')
#     print()

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

Submission status: Accepted

Solution code:
n = int(input().rstrip())

if n % 2 == 1:
    print(0)
else:
    ans = 0
    for i in range(1, 30):#10^(18)<5^(29)*2 
        ans += n // (5**i * 2)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

Submission status: Accepted

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

n = int(input())

import math

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

k = 0
while n - 2*5**k >= 0:
    k += 1
k -= 1

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

#5で割れる数が何個あるか
if n%2!=0:
    print(0)
else:
    k = 10
    ans = 0
    while k<=n:
        ans+=n//k
        k*=5
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N%2==1:
    print(0)
else:
    ans = 0
    l = []
    N//=2
    n = len(str(N))
    while True:
        a = N//5
        ans += a
        N = a
        if a==0:
            break
    print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    N = int(readline())
    if N % 2 == 1:
        print(0)
    else:
        count2 = 0
        count5 = 0
        compare = 1
        while N >= compare * 2:
            compare *= 2
            count2 += N // compare
        compare = 1
        N //= 2
        while N >= compare * 5:
            compare *= 5
            count5 += N // compare
        ans = min(count2, count5)
        print(ans)



if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def fact(N):
        res = {}
        tmp = N
        for i in range(2, int(N ** 0.5 + 1) + 1):
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            if cnt > 0:
                res[i] = cnt
        if tmp != 1:
            res[tmp] = 1
        if res == {}:
            res[N] = 1
        return res


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N = Scanner.int()
    if N % 2 == 1:
        print(0)
        return
    ans = 0
    while N > 0:
        ans += N // 10
        N //= 5
    print(ans)


def main():
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# 解説見ました。
n = int(input())
ans = 0
if n%2 == 0:
    m = 1
    for _ in range(25):
        ans += n//(m*10)
        m *= 5
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N % 2:
    print(0)
    exit()
ans = 0
tmp = 10
while N >= tmp:
    ans += N//tmp
    tmp *= 10
tmp = 50
tmp_2 = 100
while N >= tmp:
    ans += N//tmp - N//tmp_2
    tmp *= 5
    tmp_2 *= 10
print(ans)
ans = 0

Submission status: Accepted

Solution code:
from math import log10

n = int(input())

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

n -= n % 10
s = n // 10
t = s

while t != 0:
    s += t // 5
    t //= 5

print(s)

Submission status: Accepted

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

k=n//2

from math import floor

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

print(ans)

Submission status: Accepted

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

n//=2
from math import floor,factorial

ans=0
deno=5
while deno<=n:
    ans+=n//deno
    deno*=5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
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

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
n = int(input())

def func(n):
    if n % 2 == 1:
        return 0
    ans1 = 0
    ans2 = 0
    d1 = 1
    d2 = 1
    while 2 ** d1 * 2 <= n:
        ans1 += n // 2 ** d1
        d1 += 1
    while 5 ** d2 * 2 <= n:
        ans2 += n // (5 ** d2 * 2)
        d2 += 1
    ans = min(ans1, ans2)
    return ans

def func2(n):
    if n % 2 == 1:
        return 0
    x = 1
    for i in range(2, n + 2, 2):
        x *= i
    x = str(x)[::-1]
    ret = 0
    for j in x:
        if j != "0":
            return ret
        ret += 1
    return ret

ans = func(n)
print(ans)
# for i in range(100):
    # if func(i) != func2(i):
        # print("i =", i)
        # print("func(i) =", func(i))
        # print("func2(i) =", func2(i))
        # break

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 != 0:
    print('0')
else:
    count = 0
    i = 1

    while True:
        dif = (N // 2) // (5 ** i)
        count += dif
        if dif == 0:
            break

        i += 1

    print(count)

Submission status: Accepted

Solution code:
n = int(input())

if n%2==1:
    print(0)
else:
    # 2の倍数には不足しないので、5の倍数を数える
    cnt=0
    n //= 2
    while n:
        n //= 5
        cnt += n
    print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

if n%2==1:
    print(0)
else:
    # 2の倍数には不足しないので、5の倍数を数える
    i=1
    cnt=0
    while n//(5**i*2) > 0:
        cnt += n//((5**i)*2)
        i += 1
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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


print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

cnt = 0
for i in range(1,26):
  x = pow(5,i)
  x *= 2
  if x > n:
    continue
  cnt += n//x
print (cnt)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
    n = int(input())
    if n % 2 != 0:
        print(0)
        exit()
    L = n // 2
    res = 0
    while L:
        res += L // 5
        L //= 5
    print(res)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input().rstrip())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())

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

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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

    L = n // 2
    res = 0
    while L:
        res += L // 5
        L //= 5
    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
from decimal import getcontext, Decimal
getcontext().prec = 1

N = int(input())
if N % 2 == 1:
	print(0)
else:
	ans = 0
	if N <= 9:
		pass
	else:
		ans += N//10
		N //= 10
		while N >= 5:
			ans += N//5
			N //= 5
	print(ans)

Submission status: Accepted

Solution code:
import sys
n = int(input())
if n%2 == 1:
    print(0)
    sys.exit()
else:
    cur_two, cur_ten = 2, 10
    num_two, num_ten = 0, 0
    while cur_two <= n:
        num_two += n//cur_two
        cur_two *= 2
    while cur_ten <= n:
        num_ten += n//cur_ten
        cur_ten *= 5
    print(min(num_two, num_ten))

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
if n % 2 == 0:
    x = 10
    while x <= n:
        ans += n // x
        x *= 5

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    if n % 2 == 0 and n >= 10:
        m = n // 2
        k = 5
        m5 = 0
        while k <= m:
            m5 += m // k
            k *= 5
    else:
        m5 = 0

    print(m5)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import ceil
def main():
    N = int(input())
    if N%2==1:
        print(0)
        return
    else:
        # N=k*5^xのxが答えとする
        ans = 0
        N //= 2
        while N:
            ans += N//5
            N //= 5
        print(ans)
        return


main()

Submission status: Accepted

Solution code:
# def f(n):
#     if n < 2:
#         return 1
#     else:
#         return n * f(n - 2)

# for i in range(2, 150, 2):
#     print(i, f(i))

N = int(input())

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

k = 10
cnt = 0
while k <= N:
    cnt += N // k
    k *= 5

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
E - Double Factorial
https://atcoder.jp/contests/abc148/tasks/abc148_e

"""
import sys


def solve(N):
    if N % 2:
        return 0
    ans, d = 0, 10
    while True:
        q = N // d
        ans += q
        if q == 0:
            return ans
        d *= 5


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


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
n = int(input())

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

div = 10
ans = 0
while n >= div:
    tmp = n
    ans += tmp // div
    div *= 5

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0
div = 10
while(div <= N):
    ans += N // div
    div *= 5
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    if n%2==1:
        print(0)
    else:
        ans = 0
        waru = 10
        while n>=waru:
            ans += n//waru
            waru = waru*5
        print(ans)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
n=int(input())
if n%2:
  print(0)
  sys.exit()
# 10->50->2500の個数
cnt=0
v=10
while 1:
  cnt+=n//v
  if n//v==0:
    break
  v*=5
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(N):
    if N%2==1:
        return 0
    N2=(N-N%10)//10
    count_zero=N2
    x=5
    while N2>=x:
        count_zero+=N2//x
        x*=5
    return count_zero
    
        
    

N=int(input())
print(solve(N))

Submission status: Accepted

Solution code:
# 解説みた
N = int(input())
if N % 2 == 1:
    print(0)
else:
    ans = 0
    t = 10
    while t <= N:
        ans += N // t
        t *= 5
    print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

if N % 2 == 1:
    print(0)
else:
    i = 10
    ans = 0
    while(True):
        a = math.floor(N // i)
        if a < 1:
            break
        ans += a
        i *= 5
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

k, l = divmod(N, 2)

if l == 1:
    print(0)
else:
    cnt = 0
    while k > 1:
        cnt += k // 5
        k //= 5

    print(cnt)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
n=int(input())
ans=0
if n % 2==0:
    for i in range(1,10000):
        waru = 2*5**i
        if n < waru:
            break
        else:
            tmp = n//waru
            ans += tmp
print(str(ans))

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

def solve(n):
    if n % 2 == 1:
        return 0
    n //= 2
    ans = 0
    fact = 5
    while n >= 5:
        ans += n // 5
        n //= 5
    return ans

print(solve(n))

Submission status: Accepted

Solution code:
n = int(input())

p = 10
a = 0
if n % 2 == 0:
    while p <= n:
        a += n // p
        p *= 5
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())
ans = 0
if n== 0:
  print(0)
  exit()


if n%2 == 1:
  print(0)
else:
  for j in range(1,100):
    if n//((5**j)*2) == 0:
      break
    ans += n//((5**j)*2)
    
    
  print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
ans = 0
if n== 0:
  print(0)
  exit()
m = math.floor(math.log(n,5))

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

Submission status: Accepted

Solution code:
from sys import stdin
from sys import exit
def main():
    #入力
    readline=stdin.readline
    n=int(readline())

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

    print(ans)

if __name__=="__main__":
    main()

Submission status: Accepted

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

N = int(input())

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


    print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math

N = int(input())
# N, K = [int(i) for i in input().split()]
if N == 0:
    print(0)
    sys.exit(0)
if N % 2 == 1:
    print(0)
    sys.exit(0)

count = 0
digit = math.ceil(math.log(N, 5))
for i in range(1, digit+1):
    x = 5 ** i
    count += (N // (x * 2))
print(count)

Submission status: Accepted

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