#P4868. Bits
Bits
Bits
题面翻译
- $n$组询问,每次给出一个区间$l, r$,你需要输出在这个区间内二进制表示中1的个数最多的数
- 如有多个答案,输出最小的那个
- $(n \leq10^4, 0\leq l, r \leq10^{18})$
效果
-
组询问,每次给出一个区间,你需要输出在这个区间内二进制表示中1的个数最多的数
-
如有多个答案,输出最小的那个
-
题目描述
Let's denote as the number of bits set ('1' bits) in the binary representation of the non-negative integer .
You are given multiple queries consisting of pairs of integers and . For each query, find the , such that , and is maximum possible. If there are multiple such numbers find the smallest of them.
输入格式
Let's denote as the number of bits set ('1' bits) in the binary representation of the non-negative integer .
You are given multiple queries consisting of pairs of integers and . For each query, find the , such that , and 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
样例输入 #1
3
1 2
2 4
1 10
样例输出 #1
1
3
7
提示
Let's denote as the number of bits set ('1' bits) in the binary representation of the non-negative integer .
You are given multiple queries consisting of pairs of integers and . For each query, find the , such that , and is maximum possible. If there are multiple such numbers find the smallest of them.