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
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
import math

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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


def main():
    n = int(readline().rstrip())
    if n % 2 == 1:
        print(0)
    else:
        n = n // 2
        num = 0
        for i in range(1, 100):
            num += n // (5 ** i)
        print(num)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


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

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

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

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n%2 == 1:
    print(0)
    
else:
    if n < 10:
        print(0)
    else:
        list5 = []
        flag = True
        num = 5
        while flag:
            tmp = n//(num*2)
            if tmp > 0:
                list5.append(tmp)
                num *= 5
            else:
                flag = False
        ans_list = []
        for i in range(len(list5)-1):
            ans_list.append(list5[i] - list5[i+1])
        ans_list.append(list5[-1])
        ans = 0
        for i in range(len(ans_list)):
            ans += ans_list[i]*(i+1)
        print(ans)

Submission status: Accepted

Solution code:
N = int(input())

import sys
if N & 1:
    print(0)
    sys.exit()

ans = 0
N //= 2
while N != 0:
    ans += N // 5
    N //= 5

print(ans)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    
    if N % 2 != 0:
        return 0
    else:
        ans = 0
        N //= 10
        while N > 0:
            ans += N
            N //= 5
        return ans
    
print(solve())

Submission status: Accepted

Solution code:
n=int(input())

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

        cnt+=1
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def max_exponent(a, n):
    # calculate k s.t. a**k <= n < a**(k+1)
    ret, v = 0, 1
    while a * v <= n:
        ret += 1
        v *= a
    return ret


def main():
    N = int(input())
    if N % 2 == 1:
        print(0)
        return
    # N is even
    count_5_in_even, pow_5 = 0, 5
    for k in range(1, max_exponent(5, N) + 1):
        count_5_in_even += (N // pow_5) // 2
        pow_5 *= 5
    count_2_in_even, pow_2 = 0, 2
    for k in range(1, max_exponent(2, N) + 1):
        count_2_in_even += N // k
        pow_2 *= 2
    print(min(count_5_in_even, count_2_in_even))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

    print(res)

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    if n%2 == 1:
        print(0)
        return
    
    five_cnt = 0
    for i in range(1,25+1):
        base = 2*(5**i)
        five_cnt += n//base

    print(five_cnt)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

N = int(input())
# 5^26 > 10^18
if N % 2 == 1:
    print(0)
    sys.exit()

ans = 0
mul = 1
for i in range(1, 27):
    mul *= 5
    add = N // (2 * mul)
    if add == 0: break
    ans += add

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    c = 0
    
    if n % 2 == 1:
        print(0)
        return 
    
    i = 10
    x, _ = divmod(n, i)
    while x:
        c += x
        i *= 5
        x, _ = divmod(n, i)

    print(c)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *
 
N = INT()
if N%2:
	print(0)
	exit()

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *
 
N = INT()


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

Submission status: Accepted

Solution code:
n = int(input())

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

point = 0
now = 10

while now <= n:
    point += n//now
    now *= 5

print(point)

Submission status: Accepted

Solution code:
from  math import log,floor
n=int(input())

if n==0:
  print(0)
  exit(0)

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

f=floor(log(n,5))
ans=0
for i in range(f):
  t=n//(5**(f-i))
  ans+=t//2
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    if n%2==1:
        print(0)
    elif n<10:
        print(0)
    else:
        ans=0
        for i in range(1,1000000):
            y=5**i
            num=(n//y)//2
            if num==0:
                break
            else:
                ans+=num
        print(ans)
resolve()

Submission status: Accepted

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

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

    N //= 2

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())

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

L=len(str(N))
ans=0
now=5
while N//now>0:
    ans+=((N//now)//2)
    now*=5
print(ans)

Submission status: Accepted

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

    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
N = int(input())

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

N = N//2
ans = 0  
while N > 1:
  N = 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 //= 10
    ans += N
    for i in range(1, 100):
        ans += -(-(N // pow(5, i)) // 2)
print(ans)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 0
r = 10
while r <= N:
    ans += N//r
    r *= 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, 100):
        ans += n//(2*5**i)
    print(ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
if n%2:
    print(0)
    quit()
res = 0
now = 10
while now <= n:
    res += n//now
    now *= 5
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
def double_fac(n):
    if n<=2:
        return 1
    return n*double_fac(n-2)
tmp=0
if n%2==1:
    ans=0
    print(ans)
else:

    r=1
    ans=0
    k=n
    while 10*r <= n:
        ans+=(n//(10*r))
        r*=5

    print(ans)
#print(double_fac(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    while True:
        now = n//(5**i * 2)
        if now > 0:
            ans += now
        if now < 1:
            break
        i+= 1
    print(ans)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 15:35:55 2020

@author: NEC-PCuser
"""

N = int(input())

print()
if (N % 2 == 1):
    print(0)
else:
    i = N
    ans = 0
    count = 0
    while(i >= 5):
        i = i // 5 
        count += 1
    for i in range (count, 0, -1):
        ans += (N // ((5 ** i) * 2))
    print(ans)

Submission status: Accepted

Solution code:
def m():
    n = int(input())
    if n % 2 != 0: return 0
    i = 1
    ans = 0
    while True:
        tmp = n // (2*5**i) 
        if tmp == 0:
            break
        ans += tmp
        i+=1
    return ans

print(m())

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**5)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    N = gete(int)

    if N & 1 == 1:
        print(0)
        return

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

    print(ans)

Submission status: Accepted

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

x = 5
ans = 0
while x <= n:
  ans += n//(2*x)
  x *= 5

print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    if N%2 != 0:
        print(0)
        return
    k = 1
    cnt = 0
    while 1:
        p = pow(5, k)
        tmp = N//p
        if tmp == 0:
            break
        cnt += tmp//2
        k += 1
    print(cnt) 
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

    print(ans)

Submission status: Accepted

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

print(sum([n//(2*(5**i)) for i in range(1,50)]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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 == 1:
    print(0)
else:
    res = 0
    n //= 2
    while n:
        res += n//5
        n//= 5
    print(res)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *
from fractions import *

N = int(input())

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

two = 0

for p in range(1, 65):
    two += N//2**p

five = 0

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

print(min(two, five))

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

def main():
    N = int(input())
    if N%2 == 1:
        print(0)
    else:
        t = 2*5
        s = 0
        while t <= N:
             s += N//t
             t *= 5
        print(s)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def input():
    return sys.stdin.readline().rstrip('\n')

##### main

#N,T = list(map(int, input().split()))
N = int(input())

def nrof_divided_by(n, d):
    return n//d

def ndiv_list(n, d):
    l = []
    for i in range(n):
        _d = d**(i+1)
        if _d > n:
            break
        l.append(n//_d)
    return l
    
nrof_factor10 = ndiv_list(N//2,10)
nrof_factor5 = ndiv_list(N//2,5)
nrof_factor2 = ndiv_list(N//2,2)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:
    print(0)
else:
    ans = 0
    for i in range(1,100):
        ans = ans + N // (2 * 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(1,26):
        ans += n//(2*5**i)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(raw_input())


def f(n):
	if n == 0:
		return 0
	return n / 5 + f(n / 5)

def g(n):

	if n % 2 == 1: return 0

	return f(n/2)
print g(n)

Submission status: Accepted

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

Submission status: Accepted

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

n = n // 10
score = n
while n > 4:
    n //= 5
    score += n
print(score)

Submission status: Accepted

Solution code:
N = int(input())

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

    print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

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

    print(ans)
else:
    print(0)

Submission status: Accepted

Solution code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())

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

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

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

if N%2:
    ans = 0
else:
    ans = 0
    while N > 1:
        N = N//5
        ans += N//2

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
x = N
if(N%2==1):
  print(0)
else:
  ans = 0
  num = 1
  while( x//(5**num) > 1 ):
    #print(ans,(x//(5**num)//2) )
    ans += ( (x//(5**num)) // 2)
    num += 1
  print(ans)

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion
N = ri()
if N % 2 == 1:
    print(0)
    exit()
print(sum([N // (2 * (5 ** i)) for i in [j for j in range(1, 100)]]))

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    if N%2==1:
        print(0)
    else:
        ans = 0
        for i in range(1,100):
            ans += N//((5**i)*2)
        print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

n = n // 10
res = n * 1

while n > 1:
    n //= 5
    res += n
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

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

Submission status: Accepted

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

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

counter=0
i=1
while True:
    tmp = (n // 5**i)//2
    if tmp == 0:
        print(counter)
        sys.exit()
    else:
        counter += tmp
        i += 1

Submission status: Accepted

Solution code:
# ABC148 E Double Factorial

n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

N //= 2
res = 0
for i in range(100):
    res += N // 5
    N //= 5

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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


def readint():
    return int(input())


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


def readstrs():
    return input().split()


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
"""
def f(n):
    if n < 2:
        return 1
    else:
        return n*f(n-2)
"""
n = int(input())
if n%2 == 1:
    print(0)
else:
    n -= n%10
    res = 0
    tmp = 10
    while tmp <= n:
        res += n // tmp
        tmp *= 5
    print(res)

Submission status: Accepted

Solution code:
N = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
sum=0
k=1

if N%2 != 0:
    pass
else:
    while True:
        if N // (2*(5**k)) ==0:
            break
        else:
            sum += N//(2*(5**k))
            k+=1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def solve(N):
   if N < 9 or N % 2:
       return 0
   ret = 0
   N //= 2
   while N:
       ret += N // 5
       N //= 5
   return ret

if __name__ == "__main__":
    N = int(input())
    print(solve(N))

Submission status: Accepted

Solution code:
import sys
a=int(input())
if a%2==1:
  print(0)
  sys.exit()
i=10
ans=0
while i<=a:
  ans+=a//i
  i*=5
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**6)

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

def g(n):
    m = int(str(n)[:-1])
    ans = 0
    for i in range(30):
        tmp = m//pow(5, i)
        if tmp == 0:
            break
        ans += tmp
    return ans


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    if n % 2 != 0:
        print(0)
    else:
        f = [2] * 30
        for i in range(29):
            f[i + 1] = 5 * f[i]
        ans = 0
        for i in range(1, 30):
            ans += (n // f[i])
        print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:
N = int(input())
if N % 2 == 0:
    # 出てくる5の数
    m = 10
    s = 0
    while N >= m:
        s += N//m
        m *= 5

    print(s)
else:
    print(0)