The furious five
Practice
3.6 (39 votes)
Algorithms
Approved
Binary search
Easy
Grammar Verified
Recruit
Searching
Problem
41% Success 10274 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

You are given an integer N.

Write a program to find a minimum number P such that \(1 \le X \le P\) , \(\sum F(X) \ge N\) ( where \(F(X)\) represents the number of times X can be divided by 5 ).

Example

\(F(250) = 3, 250/5 = 50, 50/5 = 10, 10/5 = 2\): As 2 cannot be divided by 5, the procedure stops here.

For \(1 \le X \le P, \sum F(X)\) is defined as \(F(1) + F(2) + F(3) + F(4) + …+ F(P)\)

Input format

  • First line: T (Number of test cases)
  • First line in each test case: N

Output format

For each test case, print a minimum number P such that \(1 \le X \le P\) , \(\sum F(X) \ge N\) (where \(F(X)\) represents the number of times X can be divided by 5).

Constraints

\(1 \le T \le10^{5}\)
\(1 \le N \le 10^{9}\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
12 votes
Tags:
ApprovedBinary SearchEasyGrammar-VerifiedHiringMathSearching
Points:20
25 votes
Tags:
AlgorithmsBinary SearchBit manipulationEasySearchingTwo pointer
Points:20
536 votes
Tags:
Binary SearchData StructuresEasySearching