欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1606B.Update Files
Update Files
Berland State University has received a new update for the operating system. Initially it is installed only on the -st computer.
Update files should be copied to all 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 computers if there are only patch cables in Berland State University.
Input
The first line contains a single integer () — the number of test cases.
Each test case consists of a single line that contains two integers and () — the number of computers and the number of patch cables.
Output
For each test case print one integer — the minimum number of hours required to copy the update files to all computers.
Note
Let's consider the test cases of the example:
- , :
- during the first hour, we copy the update files from the computer to the computer ;
- during the second hour, we copy the update files from the computer to the computer , and from the computer to the computer ;
- during the third hour, we copy the update files from the computer to the computer , from the computer to the computer , and from the computer to the computer ;
- during the fourth hour, we copy the update files from the computer to the computer .
- , :
- during the first hour, we copy the update files from the computer to the computer ;
- during the second hour, we copy the update files from the computer to the computer , and from the computer to the computer ;
- during the third hour, we copy the update files from the computer to the computer , and from the computer to the computer .
- , :
- during the first hour, we copy the update files from the computer to the computer ;
- during the second hour, we copy the update files from the computer to the computer ;
- during the third hour, we copy the update files from the computer to the computer ;
- during the fourth hour, we copy the update files from the computer to the computer ;
- during the fifth hour, we copy the update files from the computer to the computer ;
- during the sixth hour, we copy the update files from the computer to the computer .
Samples
4
8 3
6 6
7 1
1 1
4
3
6
0
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |