编程介的小学生 2019-08-18 21:59 采纳率: 20.5%
浏览 167

X-Boxes程序的编写方式

Problem Description
Crazygirl is a crazy fan of XBOX games. Today, she’s here middle in a competition, in which the winner will be rewarded with an opportunity of working in the XBOX Company as a game testing player. Now, here comes the final game. As Cazygirl get a draw with the other competitor, Lich King, she must beat Lich this time.
The game is quite simple. There are n balls numbered from 1 to n and k boxes B1, B2,…, Bk satisfying following conditions:
1. With any ball x in box Bi, there must be ball 2x in box Bi+1 if there is a box Bi+1;
2. With any ball x in box Bi, there must be ball y in box Bi-1 satisfying 2y=x if there is a box Bi-1;
3. You can’t put a ball in two different boxes at the same time;
4. Your score is the number of balls in box B1;
5. The player who get the highest score win the game of course.
So, you should tell Crazygirl the highest score she can get.

Input
The first line is the number of test cases.
Each test case has one line containing two integers n and k, meaning that there are n balls and k boxes. ( 1≤n≤1010000, 2≤k≤25 )

Output
For each test case, output one line that contains an integer equals to the highest score you can get.

Sample Input
3
10 2
7 5
8 3

Sample Output
4
0
1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?