FCTRL - Factorial

题意翻译

干扰信息 GSM网络最重要的部分就是所谓的基站收发信台(BTS)。这些收发器形成了称为小区的区域,并且每个电话都以最强的信号连接到BTS。当然,BTS需要一些注意,技术人员需要定期检查其功能。 ACM技术人员最近面临一个非常有趣的问题。给定一组BTS访问,他们需要找到最短的路径访问所有给定的点,并返回到中央公司大楼。程序员已经花了几个月的时间来研究这个问题,但没有结果。他们无法快速找到解决方案。很长一段时间,其中一位程序员在会议文章中发现了这个问题。不幸的是,他发现这个问题叫做“旅行商问题”,很难解决。如果我们有N个BTS被访问,我们可以以任何顺序访问它们,给我们N!检查的可能性。表示该数字的函数称为阶乘,可以作为乘积来计算1.2.3.4 .... N。即使是相对较小的数字,这个数字也是非常高的。 程序员明白他们没有机会解决这个问题。但因为他们已经收到了政府的研究经费,所以需要继续学习,至少要有一些成果。于是他们开始研究阶乘函数的行为。 题面 定义函数Z:对于任何正整数N,Z(N)是N的阶乘的末尾的零的个数。函数Z非常有趣,所以我们需要一个可以有效地确定其值的计算机程序。 输入格式 第一行输入有一个正整数T(约等于100000)。它代表要计算Z()的数字的数量。那么就有T行,每行只包含一个正整数N,1 <=N<= 10^9。 输出格式 T行,对于每个数字N,输出单个非负整数Z(N)。 Translated by @水手hwy

题目描述

The most important part of a GSM network is so called _Base Transceiver Station_ (_BTS_). These transceivers form the areas called _cells_ (this term gave the name to the cellular phone) and every phone connects to the BTS with the strongest signal (in a little simplified view). Of course, BTSes need some attention and technicians need to check their function periodically. ACM technicians faced a very interesting problem recently. Given a set of BTSes to visit, they needed to find the shortest path to visit all of the given points and return back to the central company building. Programmers have spent several months studying this problem but with no results. They were unable to find the solution fast enough. After a long time, one of the programmers found this problem in a conference article. Unfortunately, he found that the problem is so called "Travelling Salesman Problem" and it is very hard to solve. If we have N BTSes to be visited, we can visit them in any order, giving us N! possibilities to examine. The function expressing that number is called factorial and can be computed as a product 1.2.3.4....N. The number is very high even for a relatively small N. The programmers understood they had no chance to solve the problem. But because they have already received the research grant from the government, they needed to continue with their studies and produce at least _some_ results. So they started to study behaviour of the factorial function. For example, they defined the function Z. For any positive integer N, Z(N) is the number of zeros at the end of the decimal form of number N!. They noticed that this function never decreases. If we have two numbers N $ _{1} $

输入输出格式

输入格式


There is a single positive integer T on the first line of input (equal to about 100000). It stands for the number of numbers to follow. Then there are T lines, each containing exactly one positive integer number N, 1 <= N <= 1000000000.

输出格式


For every number N, output a single line containing the single non-negative integer Z(N).

输入输出样例

输入样例 #1

6
3
60
100
1024
23456
8735373

输出样例 #1

0
14
24
253
5861
2183837