I am having trouble understanding this question. Sorry the images are not quite clear, it's a snapshot from the PC. This question was asked previous year by a company which came to our college for recruitment.

The input example given are more like the multiple of 5. But I think there is more the question I am missing.

Thanks

**UPDATE** **Don't know why images are not getting uploaded.** Image 1, part 1 Image 1, part 2

Auto comment: topic has been updated by haribhatt34 (previous revision, new revision, compare).Auto comment: topic has been updated by haribhatt34 (previous revision, new revision, compare).Note that

F(X) is the power of 5 in the prime number factorization ofX.In the given example, 250 = 2

^{1}.5^{3}is the prime number factorization of 250. Therefore,F(250) = 3.If

Xis not divisible by 5, thenF(X) = 0.Let

pbe the largest integer such that.

Then, the answer to the query

Nis 5p.S(p) can be computed iteratively asS(p) =S(p- 1) +F(5p), wherep≥ 1, and the base case isS(0) = 0.Finally, the sequence

S(0),S(1),S(2), ... is strictly increasing, as it is guaranteed thatF(5p) ≥ 1. Therefore, the sequence can be stored in an`int`

array or a`vector<int>`

C++ object when the maximum value ofNis known, and the standard library function`lower_bound()`

can be used to find the answer to each query using binary search.Thanks a lot man, for the explanation.

With pleasure