Roy and Coding Contest
Practice
4.2 (22 votes)
Ad Hoc
Approved
Easy
Implementation
Math
Open
Problem
38% Success 13170 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Roy is going to organize Finals of Coding Contest in his college's computer labs. According to the rules of contest, problem statements will be available on each computer as pdf file.

Now there are N number of computers and only one of them has the pdf file. Roy has collected M number of pendrives from his friends. Copying pdf from computer to pendrive or from pendrive to computer takes exactly 1 minute. Roy has to copy pdf to all N computers in minimum (optimal) time possible. You are to find this minimum time. Please see Sample Test Explanation for clarity.

Input:

First line will contain integer T - number of test cases.

Next T lines each will contain two space separated integers, N - number of computers, M - number of pendrives.

Output:

Print the minimum time (in minutes) for each test case in a new line.

Constraints:

\(1 \le T \le 10000\)

\( 1 \le N,M \le 1000000000 (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
58 votes
Tags:
ApprovedEasyImplementationOpen
Points:20
48 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyHiringImplementation
Points:20
77 votes
Tags:
ApprovedBasic ProgrammingEasyImplementationOpen