Input:
Enter several rows. Each row has an integer T, which is the number of test data groups, followed by T rows. Each row contains a definite positive integer N, 1 equal to = 1 000 000 000.
Output:
Output a row for each data N in the input row. The content is n! Number of 0 at the end
Analysis:
The so-called "Number of 0" refers to the total number of 10 factors, and 10 can represent the product of 2 and 5. Suppose M = n !, Then the number of 2 factors in m must be greater than the number of 5 factors. Therefore, you only need to find the number of 5 factors in M.
Since M = N * (n-1) * (n-2) * · * 1, you can use n divided by 5 to get 1 ~ Number of groups in n that can be divided by 5. However, this is not the number of all factors 5, because 1 ~ Some trees in N can be divided by 5 several times. Therefore, you must divide the number by 5 to get 1 ~ Number of groups in n that can be divided by 25. Then, divide the number by 125 and cyclically until the number is 0.
So calculate n! The formula for the number of 0 at the end is a = [N/(5*5 · * 5)]
# Include <stdio. h> void main () {int N; int I = 0; scanf ("% d", & N); int K; For (k = N; k> 0; k = -- N) {While (K % 5 = 0) {++ I; k = K/5;} printf ("the number is = % d ", I );}