POJ上有这个题目。http://poj.org/problem?id=1401。去掉一大堆没有用的信息,POJ的描述如下:
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 N1 < N2, then Z(N1) <= Z(N2). It is because we can never "lose" any trailing zero by multiplying by any positive number. We can only get new and new zeros. The function Z is very interesting, so we need a computer program that can determine its value efficiently.
大概意思就是求N!的末尾0的个数。比如:5! = 120;则末尾0的个数为1.
呵呵,这个题目还不简单么。看初中生的解法:
呵呵,代码写完了,那就测试呗。下面是我给的测试数据:
0
0