Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Poltu and Trailing Zero

By RamprosadG · Limits 1s, 512 MB

Poltu gives a problem to his friend Boltu. The description is given below-

You are given an integer N. You have to calculate the number of trailing zero of 1! × 2! × 3! × 4! × 5! ×……× (N - 1)! × N!

Here,
0! = 1 and A! = A × (A - 1)!

If you don't know about trailing zero, see this.

Input

The first line contains an integer T (1T105), number of test case.
Every Test case contains an integer N (1N109).

Output

For each test case, print the case number and the result of this problem.

Sample

InputOutput
3
4
5 
10
Case 1: 0
Case 2: 1
Case 3: 7

Discussion

Statistics


46% Solution Ratio

prodip_bsmrstuEarliest, Dec '20

steinumFastest, 0.0s

prodip_bsmrstuLightest, 3.0 MB

steinumShortest, 413B

Submit

Login to submit

Editorial

In this problem, you have to find the occurrence of 5 in 1! × 2! × 3! × 4! × 5! ×……× (N - 1)! × N! Y...

Toph uses cookies. By continuing you agree to our Cookie Policy.