Types of beakers

3.3

39 votes
C++, Math Basic, Basic Math, Math
Problem

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

1T100002N1e182K1e18

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

Editor Image

?