CF1606B.Update Files

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Berland State University has received a new update for the operating system. Initially it is installed only on the 11 -st computer.

Update files should be copied to all nn computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to copy them using a patch cable (a cable connecting two computers directly). Only one patch cable can be connected to a computer at a time. Thus, from any computer where the update files are installed, they can be copied to some other computer in exactly one hour.

Your task is to find the minimum number of hours required to copy the update files to all nn computers if there are only kk patch cables in Berland State University.

输入格式

The first line contains a single integer tt ( 1t1051 \le t \le 10^5 ) — the number of test cases.

Each test case consists of a single line that contains two integers nn and kk ( 1kn10181 \le k \le n \le 10^{18} ) — the number of computers and the number of patch cables.

输出格式

For each test case print one integer — the minimum number of hours required to copy the update files to all nn computers.

输入输出样例

  • 输入#1

    4
    8 3
    6 6
    7 1
    1 1

    输出#1

    4
    3
    6
    0

说明/提示

Let's consider the test cases of the example:

  • n=8n=8 , k=3k=3 :
    1. during the first hour, we copy the update files from the computer 11 to the computer 22 ;
    2. during the second hour, we copy the update files from the computer 11 to the computer 33 , and from the computer 22 to the computer 44 ;
    3. during the third hour, we copy the update files from the computer 11 to the computer 55 , from the computer 22 to the computer 66 , and from the computer 33 to the computer 77 ;
    4. during the fourth hour, we copy the update files from the computer 22 to the computer 88 .
  • n=6n=6 , k=6k=6 :
    1. during the first hour, we copy the update files from the computer 11 to the computer 22 ;
    2. during the second hour, we copy the update files from the computer 11 to the computer 33 , and from the computer 22 to the computer 44 ;
    3. during the third hour, we copy the update files from the computer 11 to the computer 55 , and from the computer 22 to the computer 66 .
  • n=7n=7 , k=1k=1 :
    1. during the first hour, we copy the update files from the computer 11 to the computer 22 ;
    2. during the second hour, we copy the update files from the computer 11 to the computer 33 ;
    3. during the third hour, we copy the update files from the computer 11 to the computer 44 ;
    4. during the fourth hour, we copy the update files from the computer 44 to the computer 55 ;
    5. during the fifth hour, we copy the update files from the computer 44 to the computer 66 ;
    6. during the sixth hour, we copy the update files from the computer 33 to the computer 77 .
首页