302505: CF484A. Bits
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Bits
题意翻译
``` - $n$组询问,每次给出一个区间$l, r$,你需要输出在这个区间内二进制表示中1的个数最多的数 - 如有多个答案,输出最小的那个 - $(n \leq10^4, 0\leq l, r \leq10^{18})$ ``` ### 效果 - $n$组询问,每次给出一个区间$l, r$,你需要输出在这个区间内二进制表示中1的个数最多的数 - 如有多个答案,输出最小的那个 - $(n \leq10^4, 0\leq l, r \leq10^{18})$题目描述
Let's denote as ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF484A/b30c9ebcde0f9929e0344fbd7e7dae947e957ee2.png) the number of bits set ('1' bits) in the binary representation of the non-negative integer $ x $ . You are given multiple queries consisting of pairs of integers $ l $ and $ r $ . For each query, find the $ x $ , such that $ l<=x<=r $ , and ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF484A/b30c9ebcde0f9929e0344fbd7e7dae947e957ee2.png) is maximum possible. If there are multiple such numbers find the smallest of them.输入输出格式
输入格式
Let's denote as ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF484A/b30c9ebcde0f9929e0344fbd7e7dae947e957ee2.png) the number of bits set ('1' bits) in the binary representation of the non-negative integer $ x $ . You are given multiple queries consisting of pairs of integers $ l $ and $ r $ . For each query, find the $ x $ , such that $ l<=x<=r $ , and ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF484A/b30c9ebcde0f9929e0344fbd7e7dae947e957ee2.png) is maximum possible. If there are multiple such numbers find the smallest of them.
输出格式
For each query print the answer in a separate line.
输入输出样例
输入样例 #1
3
1 2
2 4
1 10
输出样例 #1
1
3
7