zrzr

Link to Russian translation the problem

You are given a number N. How many zeroes does N! end on?

Input
The first line contains one integer T - number of test cases.
The following T lines contain one integer each - N.

Output
For each test case output one integer per line - the answer for this question.

Constraints
T ≤ 1000
0 ≤ N ≤ 10^11

SAMPLE INPUT
3
9
11
20

SAMPLE OUTPUT
1
2
4

Source: hackerearth | Difficulty: EASY
Tags: Number theory

Mathematics


Solutions:
for i in range (eval(input())):
	a=eval(input())
	k,s=1,0
	n=5**k
	while(n<=a):
		s+=int(a/n)
		k+=1
		n=5**k
	print(s)


import math
def no_of_zeros(no):
	c=0;
	i=1;
	while(no>=5):
		power_of_f=int(math.pow(5,i));
		no=no/power_of_f;
		c=c+no;
	return c
x=eval(input());
res=[];
while(x>0):
	r=eval(input());
	res.append(no_of_zeros(r));
	x=x-1;
for z in res:
	print(z)


t=int(input())
while t>0:
	n=int(input())
	c=0
	while n>0:
		c+=n/5
		n/=5
	print(c)
	t-=1


for _ in range(eval(input())):
	n=eval(input())
	c=0
	while n>0:
		n=n//5
		c=c+n
	print(c)



def get_zeros(number):
    
	#get numbers of 5 in the number
	remainder =1
	n_5=1
	get_5 =0
	while remainder >0:
		n_5=5*n_5
		remainder = number/n_5
		get_5 +=remainder
	return get_5
	
	
test = int(input())
Array = []
for i in range(test):
	Array.append(get_zeros(int(input())))
	
for item in Array:
	print(item)
	


def get_zeros(number):
    
	#get numbers of 5 in the number
	remainder =1
	n_5=1
	get_5 =0
	while remainder >0:
		n_5=5*n_5
		remainder = number/n_5
		get_5 +=remainder
	   
	remainder =1    
	n_2=1
	get_2 = 0
	while remainder >0:
		n_2=2*n_2
		remainder = number/n_2
		get_2 +=remainder
		
		
	if get_5 < get_2:
	 
		return get_5
	else:
	   
		return get_2
	
	
test = int(input())
Array = []
for i in range(test):
	Array.append(get_zeros(int(input())))
	
for item in Array:
	print(item)
	


t=int(input())
for i in range(t):
	n=int(input())
	res=0
	while n!=0:
		res+=n/5
		n=n/5
	print(res)


tc=int(input())
for i in range(tc):
	n=int(input())
	div=5
	res=0
	while(div<=n):
		res+=n/div
		div*=5
	print(res)
		


t = int(input())

for i in range(t):
	x,y,out = int(input()),5,0
	while x/y > 0:
		out = out + (int( x/y))
		y = y*5
	print(out)


def sumBase(n, p):
	res = 0
	while n != 0:
		res += n % p
		n = n / p
	return res

def zrzr(n):
	fiveCount = (n - sumBase(n, 5)) / (5 - 1)
	a = 0
	return a + fiveCount

from sys import stdin
# inp = open("ZrZr.in", "r")
inp = stdin
test = int(inp.readline().strip())
for i in range(test):
	n = int(inp.readline().strip())
	print(zrzr(n))


sm=0
t=eval(input())
for j in range(t):
	n=eval(input())
	sm=0
	i=1
	x=n
	while x>1:
		y=pow(5,i)
		sm=sm+n/y
		i+=1
		x=n/y
	print(sm)    


for __ in range(eval(input())):
	x = eval(input())
	ans = 0
	while x:
		x/=5
		ans+=x
	print(ans)




def num_zero(N):
	count = 0
	while N > 1:
		N = N // 5
		count += N
	return count
	
if __name__ == '__main__':
	for _ in range(int(input())):
		print(num_zero(int(input())))


def get_zeros(number):
    
	#get numbers of 5 in the number
	remainder =1
	n_5=1
	get_5 =0
	while remainder >0:
		n_5=5*n_5
		remainder = number/n_5
		get_5 +=remainder
	   
	remainder =1    
	n_2=1
	get_2 = 0
	while remainder >0:
		n_2=2*n_2
		remainder = number/n_2
		get_2 +=remainder
		if get_2>get_5:
			return get_5
			
		
  
	   
	return get_2
	
	
test = int(input())
Array = []
for i in range(test):
	Array.append(get_zeros(int(input())))
	
for item in Array:
	print(item)
	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

testcase = eval(input())
for i in range(testcase):
	num = eval(input())
	temp = 5
	val = 0
	
	while num >= temp:
	   val += num / temp
	   temp *= 5
	print(val)


t=int(eval(input()))
for i in range(t):
	n=eval(input())
	j=5
	c=0 
	while int(n/j)>=1:
		c+=n/j
		j=j*5
	print(c)


t=eval(input())
while(t):
	t=t-1
	n=eval(input())
	count=0
	j=1
	while(1):
		i=n/pow(5,j)
		if(i==0):
			break
		count=count+i
		j=j+1
	print(count)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'

t=eval(input())
while t>0:
	t-=1
	n=eval(input())
	i=1
	z=0
	p=1
	while (n>p):
		p=pow(5,i)
		z+=n/p
		i+=1
	print(z)


for _ in range(eval(input())):
	c=0
	n=eval(input())
	while n>0:
		n=n//5
		c=c+n
	print(c)
        



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello W
n = eval(input())
for i in range(n):
	a = eval(input())
	count = 0
	while a:
		count += a/5
		a = a/5
	print(count)
	


for tc in range(eval(input())):
	n=eval(input())
	x=5
	r=0
	while n>=x:
		r+=n/x
		x*=5
	print(r)