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: Wrong Answer

Solution code:
N = int(input())

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

print(res)

Submission status: Wrong Answer

Solution code:
from math import floor
n=int(input())
ans=0
d=10
while d<=n:
  ans+=floor(n/d)
  d*=5
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0
if N%2==1:
    print(0)
    exit()
powNum = 1
while 2*pow(5,powNum) < N:
    count += N//(2*pow(5,powNum))
    powNum+=1
print(count)

Submission status: Wrong Answer

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(read())
cnt = 0
for i in range(n):
    n //= 5
    cnt += n // 2
    if n < 5:
        break
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    output = 0
    T = 10
    while N//T > 0:
        output += N//T
        T *= 5
    print(output)
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def f(n):
  d = 2
  ans = 0
  while n>d:
    d*=5
    n//=d
    ans += n
  return ans

x = int(input())
print(0 if x%2!=0 else f(x))

Submission status: Wrong Answer

Solution code:
def f(n):
  d = 2
  ans = 0
  while n>d:
    d*=5
    n//=d
    ans+=n
  return ans

print(f(int(input())))

Submission status: Wrong Answer

Solution code:
def f(n,x):
  ret = 0
  while n>1:
    n = (n+x-1)//x
    ret+=n
  return ret

n = int(input())
print(min(f(n,2), f(n,5)))

Submission status: Wrong Answer

Solution code:
def f(n,x):
  ret = 0
  while n>0:
    n//=x
    ret+=n
  return ret

n = int(input())
print(min(f(n,2), f(n,5)))

Submission status: Wrong Answer

Solution code:
n = int(input())

mul_5 = 0
ans = 0
while n > 2 * 5**mul_5:
    mul_5 += 1
if n % 2 == 0:
    for i in range(1, mul_5):
        ans += n // (2 * 5**i)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
l = len(n)
n = int(n)
if n == 0:
  print(1)
elif n % 2 == 1:
  print(0)
else:
  c = 0
  for i in range(1, 19):
    c += n // (10**i)
  print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import functools
import math
import scipy
import fractions
import itertools

def solve():
    n = int(input())
    if n % 2 != 0:
        print(0)
    else:
        ans = 0
        hoge = 10
        while True:
            huga = math.floor(n / hoge)
            if hoge <= n:
                ans += huga
            else:
                break
            hoge *= 5
            print(hoge)
        print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
import numpy as np
import functools
import math
import scipy
import fractions
import itertools

def solve():
    n = int(input())
    if n % 2 != 0:
        print(0)
    else:
        ans = 0
        hoge = 10
        while True:
            huga = math.floor(n / hoge)
            if huga > 0:
                ans += huga
            else:
                break
            hoge *= 5
        print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
n = int(input())

if (n % 2) != 0:
    print(0)
else:
    ans = 0
    k = 0
    m = len(str(n))
    while( n > 10*(5**k)):
        ans += (n//(10*(5**k)))
        k+=1
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=input()
lenN=len(N)
N=int(N)


if N%2==1 or N<10:
    print(0)
else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop) or N%(10*5**loop)!=0:
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
            print(count)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    
    if n%2==1:
        print(0)
    else:
        N=n//2
        cnt=0
        while N>=5:
            cnt+=N//5
            N/=5
        print(int(cnt))
        



    
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    
    if n%2==1:
        print(0)
    else:
        N=n//2
        cnt=0
        while N>=1:
            cnt+=N//5
            N/=5
        print(int(cnt))
        



    
resolve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n=int(input())
if n<10:
    print(0)
elif n%2==0:
    a=int(n/2)
    b=0
    for i in range(n):
        a=a//5
        b+=a
        if a<4.5:
            break
    print(b)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n%2==0:
    a=int(n/2)
    b=0
    for i in range(n):
        a=a//5
        b+=a
        if a<4.5:
            break
    print(b)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n%2==0:
    a=int(n/2)
    b=0
    for i in range(n):
        a=a//5
        b+=a
        if a<5:
            break
    print(b)
else:
    print(0)

Submission status: Wrong Answer

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

    if N%2!=0:
        print(0)
    
    k=10
    ans=0
    while(k<=N):
        ans+=N//k
        k*=5
    print(ans)
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:

import sys
sys.setrecursionlimit(1000000)

N = int(input())


def calc(n, p):
    if n < p:
        return 0
    else:
        return int(n/p) + calc(int(n/p), p)


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

print(calc(int(N/2), 5))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

for j in range(10**8):
    num = N//(i*2)
    if num == 0:
        break
    else:
        ans += num
        i = i*5

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
print(n)

half = n // 2

ans = half / 5

print(ans)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
n = int(input())
ans = 0
div = 10
while div < n:
    ans += n // div
    div *= 5
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
five=5
two=2
F=0
T=0
if N%2==1:
    print(0)
else:
    N = int(N/2)
    T += N
    while five <= N:
        F += int(N//five)
        five *= 5
        
    print(int(F))

Submission status: Wrong Answer

Solution code:
N=int(input())
five=5
two=2
F=0
T=0
if N%2==1:
    print(0)
else:
    N = int(N/2)
    T += N
    while five < N:
        F += int(N//five)
        five *= 5
        
    print(int(F))

Submission status: Wrong Answer

Solution code:
N=int(input())
five=5
two=2
F=0
T=0
if N%2==1:
    print(0)
else:
    N = int(N/2)
    T += N
    while five < N:
        F += int(N//five)
        five *= 5
    while two < N:
        T += int(N//two)
        two *= 2
        
    print(int(min(T,F)))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
###### Importing Libraries ######
import math
import operator as op
from functools import reduce
from fractions import Fraction as frac
#################################
##### User defined function #####

############ NCR ###############
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
    
############ READ ###############
def rd(p):
    if(p==0):
        return input()
    if(p==1):
        return int(input())
    if(p==2):
        return map(int,input().split())
    if(p==3):
        return list(map(int,input().split()))


############ DSU ###############
global par
par=[-1 for i in range(100001)]
# t=rd(1)
def find(u):
    if(par[u]<0):
        return u
    else:
        return find(par[u])
def uni(x,y):
    u=find(x)
    v=find(y)
    if u==v:
        return
    if(par[u]<par[v]):
        par[u]+=par[v]
        par[v]=u
    else:    
        par[v]+=par[u]
        par[u]=v
################################        
        

t=1
for term in range(1,t+1):
    n=rd(1)
    div=10
    tot=0
    if n%2==1:
        print(0)
    else:    
        while(n>div):
            # print(n//div)
            tot+=(n//div)
            div*=5
        print(tot)

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
ans = 0
N = int(input())
if N % 2 == 1:
    print(0)
else:
    N = N /2
    while N >= 5:
        ans += N // 5
        N = N // 5
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

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

# keta = 1 -> 0
# keta = 2 -> 10,20,30,...90 = 10
# keta = 3 -> 100,200,...900 = 19
# keta = 4 -> 1000,...9000 = 28

keta = len(str(n))
ans = 0
res = 0
memo = [0 for _ in range(keta)]
for i in range(2,keta):
	ans = 9 * (i-1) + 1 + 9 * sum(memo)
	memo[i] = ans
"""
for i in range(len(memo)):
	print(memo[i])
"""
string = str(n)

ans = 0
for i in range(len(str(n))):
	tmp = int(string[i])
	if tmp >= 5:
		ans += 1
	ans += (memo[-i-1]+keta-i-1) * tmp
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
n = N // 10
lista = []

while n != 0:
    lista.append(n)
    n //= 5
print(sum(lista))

Submission status: Wrong Answer

Solution code:
n = int(input())
b = True
k = 0 #カウント用
i = 0
if n == 0:
    print(0)
elif n % 2 == 1:
    print(0)
else:
    while n // (10  * (5 ** i)) > 0:
        k += n // (10 * (5 ** i))
        i += 1
print(k)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N % 2 == 1:
    print(0)
    #quit()
N //= 2
res = 0
i = 0
while (5 ** i) <= N:
    #print(N)
    i += 1
    res += N // (5 ** i)
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N % 2 == 1:
    print(0)
    quit()
N /= 2
res = 0
while N:
    #print(N)
    res += int(N / 5)
    N = int(N / 5)
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ret = 0
waru = 10

if n % 2 == 1:
    print(0)
else:
    while n >= waru:
        ret += n // waru
        waru *= 5

print(ret)

Submission status: Wrong Answer

Solution code:
n = int(input())

ret = 0
waru = 10

if n % 2 == 1:
    print(0)
else:
    while n > waru:
        ret += n // waru
        waru *= 5

print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    if N % 2 == 1:
        print(0)
        return
    n = 2
    cnt = 0
    while n * 5 < N:
        n *= 5
        cnt += 1
    ans = 0
    for _ in range(cnt):
        ans += N // n
        n //= 5
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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
    while True:
        if n <= val: break
        cnt += n//val
        val *= 5
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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
    while True:
        if n//val < 1: break
        cnt += n//val
        val *= 5
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

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

main()

Submission status: Wrong Answer

Solution code:
import math

def main():
    ans = 0
    den = 10
    N = int(input())
    while(N >= den):
        ans += math.floor(N / den)
        den *= 5
    print(ans)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# E - Double Factorial

N = int(input())

ans = 0
p = 10

while True:
    if p > N:
        break
    ans += N // p
    p *= 5

print(ans)

Submission status: Wrong Answer

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)

Submission status: Wrong Answer

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)

Submission status: Wrong Answer

Solution code:
def factorial(n):
     if n == 0:
         return 1
     else:
         return n * factorial(n-1)

Submission status: Wrong Answer

Solution code:
def findTrailingZeros(n): 
      
    # If n is odd 
    if (n & 1): 
        return 0
  
    # If n is even 
    else: 
        ans = 0
  
        # Find the trailing zeros 
        # in n/2 factorial 
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        # Return the required answer 
        return ans 
   
  
n = 12
  
print(findTrailingZeros(n))

Submission status: Wrong Answer

Solution code:
n=12
def doublefactorial(n): 
    if (n == 0 or n == 1): 
        return 1; 
    return n * doublefactorial(n - 2);

def trailing_zeros(longint):
    manipulandum = str(longint)
    return len(manipulandum)-len(manipulandum.rstrip('0'))
  
print("Double factorial is",  
       doublefactorial(n));

print('trailing zeroes are'+ str(trailing_zeros(doublefactorial(n))))

Submission status: Wrong Answer

Solution code:
def doublefactorial(n): 
    res = 1; 
    for i in range(n, -1, -2): 
        if(i == 0 or i == 1): 
            return res; 
        else: 
            res *= i; 
print("Double factorial is",  
        doublefactorial(5));

Submission status: Wrong Answer

Solution code:
def findTrailingZeros(n): 

      

    # If n is odd 

    if (n & 1): 

        return 0

  

    # If n is even 

    else: 

        ans = 0

  

        # Find the trailing zeros 

        # in n/2 factorial 

        n //= 2

        while (n): 

            ans += n // 5

            n //= 5

  

        # Return the required answer 

        return ans 

  
# Driver code 

  

n = 12

  

print(findTrailingZeros(n))

Submission status: Wrong Answer

Solution code:
#function to find double  
# factorial of given number 
def doublefactorial(n): 
  
    if (n == 0 or n == 1): 
        return 1; 
    return n * doublefactorial(n - 2); 
  
# Driver Code 
print("Double factorial is",  
       doublefactorial(5)); 
  
# This code is contributed 
# by Tushar

Submission status: Wrong Answer

Solution code:
n = int(input())

a = [0,1]
for i in range(19):
    a.append(a[len(a)-1]*10+1)

ans = 0
for i in range(1,19):
    ans += ((int)(n/10**(i)))%10*a[i]

iter = 27
for i in range(iter):
    k = pow(5,iter-i-1)

    for j in range(1,18):
        x = k*(10**j)
        a = (int)((int)((n+x)/(2*x)))
        b = a-(int)((a+2)/5)
        ans += b*(iter-i-1)

if n%2 == 1:
    ans = 0

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = [0,1]
for i in range(19):
    a.append(a[len(a)-1]*10+1)

ans = 0
for i in range(1,19):
    ans += ((int)(n/10**(i)))%10*a[i]

iter = 27
for i in range(iter):
    k = pow(5,iter-i-1)

    for j in range(1,18):
        x = k*(10**j)
        a = (int)((int)((n+x)/(2*x)))
        b = a-(int)((a+2)/5)
        ans += b*(iter-i-1)


print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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
for i in L:
  A += N // i
print(A)

Submission status: Wrong Answer

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

from math import floor

n = int(readline())
if n % 2 == 1 or n < 10:
    print(0)
else:
    ans = 0
    for i in range(1, 64):
        if n >= (2 * 5 ** i):
            ans += floor(n / (2 * 5 ** i))
        else:
            print(ans)
            exit()

Submission status: Wrong Answer

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

from math import floor

n = int(readline())
if n % 2 == 1 or n < 10:
    print(0)
else:
    ans = 0
    for i in range(1, 64):
        if n >= (2 * 5 ** i):
            ans += floor(n / (2 * 5 ** i))
        else:
            print(ans, floor(n / 1250))
            exit()

Submission status: Wrong Answer

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

from math import floor

n = int(readline())
if n < 2:
    print(1)
elif n % 2 == 1 or n < 10:
    print(0)
else:
    ans = floor(n / 10)
    for i in range(1, 64):
        if n >= (10 * 5 ** i):
            ans += floor(n / (10 * 5 ** i))
        else:
            print(ans)
            exit()

Submission status: Wrong Answer

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

from math import floor

n = int(readline())
if n % 2 == 1 or n < 10:
    print(0)
else:
    ans = floor(n / 10)
    for i in range(1, 64):
        if n >= (10 * 5 ** i):
            ans += floor(n / (10 * 5 ** i))
        else:
            print(ans)
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

n = int(input())

if n >= 2 and n % 2 == 0:
    m = int(n / 2)
    ans = 0
    for i in range(1, math.floor(math.log(m, 5)) + 1):
        ans += math.floor(m / 5**i)

    print(ans)
else:
    print(0)

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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):
        count+=N//10**i
    print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 2 != 0:
    ans = 0
else:
    ans = 0
    while n:
        ans += n // 5
        n //= 5

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
n = n // 2

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 += int(n / fexp)

print(result)

Submission status: Wrong Answer

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

ans = 0

if N % 2 != 0:
    pass
elif N == 0:
    ans = 1
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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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



if __name__ == '__main__':
#	main()
	test()

Submission status: Wrong Answer

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

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import sys

N=int(input())

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

ans=0
a=10

while N//a!=0:
    ans=ans+N//a
    a=a*10

print(ans)

Submission status: Wrong Answer

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: Wrong Answer

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)

    n = int(int(n) / int(2))
    while True:
        n = int(int(n) // int(5))
        if n == 0:
            break

        ret += int(n)

    print(int(ret))


main()

Submission status: Wrong Answer

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)

    n = int(n) / int(2)
    while True:
        n = int(int(n) // int(5))
        if n == 0:
            break

        ret += int(n)

    print(int(ret))


main()

Submission status: Wrong Answer

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)
    n = int(n) / int(2)
    while True:
        n = n // 5
        if n == 0:
            break

        ret += int(n)

    print(int(ret))


main()

Submission status: Wrong Answer

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)
    n = n / 2
    while True:
        n = n // 5
        if n == 0:
            break

        ret += int(n)

    print(int(ret))


main()