Types of beakers
Practice
3.3 (39 votes)
C++
Math basic
Basic math
Math
Problem
75% Success 3978 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code

You are doing the study of amoeba. There are two types of beakers:

  • Beaker1: Capacity to store infinite amoeba
  • Beaker2: Capacity to store only \(N\) amoeba

On the first day, they put 1 amoeba in Beaker2 and after every 24 hours the total count of amoeba doubles.
\(day:\ 1\ \   2\ \   3\ \   4\ \   5\ \   6\ \   .......\\ count: 1\ \   2\ \   4\ \   8\ \   16\ \   32\ \   .......\)

If on any particular day Beaker2 overflows, then you transfer only \(N\) amoeba to Beaker1 and discard the rest of amoeba.

From the next day, you start with 1 amoeba again and repeat the process infinitely. Determine the number of days in which the total count amoeba crosses \(K\) (greater or equal).

Note

  • Total count is equal to amoeba in Beaker1 + Beaker2
  • Fission only takes place in Beaker2 not in Beaker1

Input format

  • The first line contains a single integer \(T\) denoting the number of test cases. The description of \(T\) test cases follows.
  • Each test case contains two integers denoting \(N\) and the value of \(K\).

Output format

For each test case, print a single line containing the number of days.

Constraints

\(1 ≤ T ≤ 10000\\ 2 ≤ N ≤1e18\\ 2 ≤ K ≤ 1e18\)

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
239 votes
Tags:
Ad-HocMathematicsOpenApprovedEasyMathamatics
Points:20
23 votes
Tags:
Ad-HocMathematicsOpenApprovedEasyMathamatics
Points:20
432 votes
Tags:
Ad-HocEasyMath