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

import sys
import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    e = ii()
    if e == 0 or e % 2 == 1:
        print(0)
    else:
        ans = e // 10
        d = 50
        while d <= e:
            ans += e // d
            d *= 5
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
import fractions
import sys
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))



def funct(n):
	i=1
	res=0
	while True:
		ans=2*5**i
		
		if n//ans==0:
			break
		res+=(n//ans)
		i+=1
	return res


N=input1()
a=0
if N%2==1:
	a=0
else:
	a=funct(N)

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
total = 0
i = 1

while(n//pow(5, i)):
    if n%2 == 0:
        total += (n // pow(5, i)) // 2
    i += 1

print(total)

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    n = II()
    cnt = 0
    val = 10
    if n%2==1: print(cnt); exit(0)
    while True:
        if n < val: break
        cnt += n//val
        val *= 5
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

P = 998244353


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

def main():
    ans = 0
    den = 10
    N = int(input())
    while(N >= den):
        ans += N // den
        den *= 5
    if N % 2 == 0:
        print(ans)
    else:
        print(0)

main()

Submission status: Accepted

Solution code:
n = int(input())
UPPER = 10**18

def solve(n):
    if n%2 == 1:
        return 0
    res = 0
    fiv = 2*5
    while fiv <= n:
        res += n // fiv
        fiv *= 5
    return res

print(solve(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 1:
  print(0)
  exit()
else:
  N //= 2
  ans, i = 0, 1
  while N // pow(5, i) != 0:
    ans += N // pow(5, i)
    i += 1
print(ans)

Submission status: Accepted

Solution code:
# E - Double Factorial

N = int(input())

ans = 0
p = 10

if (N%2==0):
    while True:
        if p > N:
            break
        ans += N // p
        p *= 5

print(ans)

Submission status: Accepted

Solution code:
import sys
import math

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

p = n / 2

x = int(math.log(p, 5))
#print(x)

count = 0
""" for i in range(1,x+1):
    count += int(p/(5**i))
    #print(i,p,p/(5**1))
print(count) """
i = 1
while i * 10 <= n:
    #print(i)
    count += n // (i*10)
    #print('aaa',n // i*10)
    i *= 5
print(count)

Submission status: Accepted

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

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

N = N // 2

while (N >= 5):
    N = N // 5
    ans += N

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
n = int(readline())
if n % 2 == 1:
    print(0)
else:
    n //= 2
    answ = 0
    while n:
        n //= 5
        answ += n
    print(answ)

Submission status: Accepted

Solution code:
import sys
import math
import numpy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p = int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while p:
        p //= 5
        ans += p
    print(ans)

Submission status: Accepted

Solution code:
def findTrailingZeros(n): 
      
    if (n%2!=0): 
        return 0

    else: 
        ans = 0
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        return ans 
  
n = int(input())
  
print(findTrailingZeros(n))

Submission status: Accepted

Solution code:
def findTrailingZeros(n): 
    if (n & 1): 
        return 0
    else: 
        ans = 0
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
        return ans 

  
n = int(input())
  
print(findTrailingZeros(n))

Submission status: Accepted

Solution code:
import sys
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p = int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while p:
        p //= 5
        ans += p
    print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
l= int(readline())
if l% 2 == 1:
    print(0)
else:
    l //= 2
    ans = 0
    while l:
        l //= 5
        ans += l
    print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
nu = int(readline())
if nu % 2 == 1:
    print(0)
else:
    nu //= 2
    answ = 0
    while nu:
        nu //= 5
        answ += nu
    print(answ)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
n1 = int(readline())
if n1 % 2 == 1:
    print(0)
else:
    n1 //= 2
    ans = 0
    while n1:
        n1 //= 5
        ans += n1
    print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p = int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while p:
        p //= 5
        ans += p
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if(n%2==1):
    print(0)
    exit()
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
    for i in range(1,27):
        ans+=N//(2*(5**i))
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

def ans(n):
    if n % 2 != 0:
        return 0
    else:
        index,count = 1,0
        while 2 * 5**index <= n:
            count += n // (2 * 5**index)
            index += 1
    return count

print(ans(N))

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

Submission status: Accepted

Solution code:
L = [10, 50, 250, 1250, 6250, 31250, 156250, 781250, 3906250, 19531250, 97656250, \
     488281250, 2441406250, 12207031250, 61035156250, 305175781250, 1525878906250, \
     7629394531250, 38146972656250, 190734863281250, 953674316406250, \
     4768371582031250, 23841857910156250, 119209289550781250, 596046447753906250]
N = int(input())
A = 0
if N % 2 == 0:
  for i in L:
    A += N // i
print(A)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

else:
  counter2 = 0
  counter5 = 0
  
  stock = n
  stock = stock//2
  
  while stock > 0:
    stock = stock//5
    counter5 += stock
    
  stock = n//2
  counter2 += stock
  while stock > 0:
    stock = stock//2
    counter2 += stock
    
  print(min(counter2, counter5))

Submission status: Accepted

Solution code:
N = int(input())

# 奇数をいくらかけても10の倍数にはならない
if N % 2 != 0:
  print(0)
else:  
  counter = [0] * 25
  for i in range(25):
    counter[i] = N // (2 * 5 ** (i + 1))
  for i in range(24, -1, -1):
    counter[i] = counter[i] - sum(counter[i + 1:])
    
  total = 0
  for i in range(25):
    total += ((i + 1) * counter[i])
                                  
  print(total)

Submission status: Accepted

Solution code:
n = int(input())

def div_5(n):
    cnt = 0
    mod = 5 * 2
    while mod <= n:
        cnt += n // (mod)
        mod = mod * 5
    return cnt

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

Submission status: Accepted

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

Submission status: Accepted

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

num = 2*5
ans = 0

while n>=num:
    ans += n//num
    num *= 5

print(ans)

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n = int(input().strip())
    if n % 2 == 1:
        ans = 0
    else:
        ans = 0
        for i in range(1, 10**6):
            if 2*5**i > n:
                break
            ans += n//(2*5**i)

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
from decimal import *
N=int(input())
insuuof10=0
cnt=0
if N%2==1:
    print("0")
else:
    for i in range(1,28,1):
        cnt=cnt+N//(2*pow(5,i))

    print(cnt)
#111111111111111111
#124999999999999995

Submission status: Accepted

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

    print(ans)

Submission status: Accepted

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

else:
    ans = 0
    tmp = 10
    while N >= tmp:
        ans += N // tmp
        tmp *= 5

    print(ans)

Submission status: Accepted

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

if N%2 != 0:
    print(0)
else:
    flag = True
    while flag:
        i = N//g
        if i == 0:
            break
        ans += i
        g *= 5
    
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

if n % 2 == 0:
    n //= 10
    for i in range(27):
        ans += n // 5 ** i

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

k = (N + 1) // 2
pow2, pow5 = k, 0
# pow2
tmp = k
while tmp > 0:
    pow2 += (tmp // 2)
    tmp = (tmp // 2)
# pow 5
tmp = k
while tmp > 0:
    pow5 += (tmp // 5)
    tmp = (tmp // 5)


if N % 2 == 0:
    print(min(pow2, pow5))
else:
    pow2 = -pow2
    pow5 = -pow5
    k = 2 * k
    tmp = k
    while tmp > 0:
        pow2 += (tmp // 2)
        tmp = (tmp // 2)
    tmp = k
    while tmp > 0:
        pow5 += (tmp // 5)
        tmp = (tmp // 5)
    print(min(pow2, pow5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

if int(N[-1])%2 == 1:
    print(0)
else:
    N = int(N)
    ans = N//10
    for i in range(2,1000):
        tmp = 2*5**i
        if tmp > N:
            break
        else:
            ans += N//tmp
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

if N%2==1:
    print(0)
    exit()
ans=0
tmp=10
while(N>=tmp):
    a=N//tmp
    ans+=a
    tmp=tmp*5
print(ans)

Submission status: Accepted

Solution code:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
if N&1:
    print(0); exit()

def func(x):
    # x以下の偶数で5の因数をいくつ持つか
    x //= 2
    ret = 0
    while x >= 5:
        ret += x // 5
        x //= 5
    return ret

answer = func(N)
print(answer)
# 16

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 functools import lru_cache
import bisect
import re
import queue
from decimal import *


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 [input() 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 [int(input()) 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


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 main():
    # sys.stdin = open("sample.txt")
    N = Scanner.int()
    if N % 2 == 1:
        print(0)
    else:
        ans = 0
        while N > 0:
            ans += (N // 5) // 2
            N //= 5
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

    score = 0
    b = 1
    while True:
        b *= 5
        if b > n:
            break
        score += n // b
    print(score)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())

result = 0
if n % 2 != 1:
    fexp = 0
    for i in range(1, n):
        fexp = 5 ** i * 2
        if fexp > n:
            break
        result += n // fexp

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
cnt_10=0
MAX_10=0
if n%2==1:
    print(0)
else:
    for i in range(100):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)

Submission status: Accepted

Solution code:
n=int(input());a=m=n//10
while m:m//=5;a+=m
print(-~n%2*a)

Submission status: Accepted

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

ans = 0

if N % 2 != 0 or N == 0:
    pass
else:
    max_pow_five = int(math.log(N, 5))
    for i in range(1, max_pow_five + 1):
        ans += N // ((5 ** i) * 2)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import sys
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
from bisect import insort
sys.setrecursionlimit(10**9)

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

    ans = 0
    if N % 2 == 0:
        max = math.ceil(math.log(10**18/2,5))
        for i in range(1,max):
            ans += N // (pow(5,i) * 2)

    print(ans)


if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
import math
def main():
	N = int(input())
	if N%2 == 1 or N==0:
		print(0)
	else:
		N = N//2
		P = int(math.log(N,5))
		ans = [ N//(5**p) for p in range(1,P+1)]
		print(sum(ans))

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
import sys

N=int(input())

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

ans1=0
ans2=0
a=2
b=5

while N//a!=0:
    ans1=ans1+N//a
    a=a*2
while N//b!=0:
    ans2=ans2+N//b//2
    b=b*5

print(min(ans1,ans2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import time
from collections import deque
from copy import deepcopy

t = time.time()
def iip():
    ret = [int(i) for i in input().split()]
    if len(ret) == 1:
        return ret[0]
    return ret


def main():
    n = iip()

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

    ret = int(0)

    num = 10
    while num <= n:
        ret += n // num
        num *= 5

    print(int(ret))


main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

if n%2 == 0:
  ans = 0
  l = 1
  while(True):
    if n//pow(5, l) == 0:
      break
    ans += n//pow(5, l)//2
    l+=1
  print(ans)
else:
  print(0)

Submission status: Accepted

Solution code:
def fun(n):
    if n%2!=0:
        return 0
    else:
        ans=0
        n//=2
        while(n):
            ans=ans+n//5
            n=n//5
    return ans


n = int(input())
if n>=2:
    print(fun(n))
else:
    print(0)

Submission status: Accepted

Solution code:
p=int(input())
n=p
if n%2 == 0:
    num=10
    c=0;
    while num <= n:
        c += (n//num)
        num *= 5
    print(c)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
n = int(sys.stdin.readline().strip())
if n % 2 != 0:
    print(0)
    sys.exit(0)
down = 10
accum = 0
while True:
    crt = n // down
    if crt < 1:
        break
    accum += crt
    down *= 5
print(accum)

Submission status: Accepted

Solution code:
N = input()
if len(N) <= 1:
  print(0)
  exit()
if int(N[-1]) %2 == 0:
    ans = int(N[:-1])
    N = int(N[:-1])
    k = 1
    while k != 0:
        k = N // 5
        N = k
        ans += k
    print(ans)
else:
    print(0)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


n = int(input())
digi = len(str(n))
ans = 0
if not bool(n&1):
    for i in range(1,50):
        ans += n//(5**i)//2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

# Nが奇数の時は2が1つもないので0
if N % 2 == 1:
    print(0)
# Nが偶数の時は5の数を数える
# N以下の2の倍数のうち
# 5の倍数の数 + 25の倍数の数 + ...
else:
    ans = 0
    for i in range(1, 50):
        ans += (N // 5 ** i) // 2

    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 0:
    count = 10
    amount_5 = 0
    while count <= N:
        amount_5 += N // count
        count = count * 5
else:
    amount_5 = 0

print(amount_5)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N = inputI()

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

Submission status: Accepted

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

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