当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5661:Claris and XOR

题目描述
Claris loves bitwise operations very much, especially XOR, because it has many beautiful features. He gets four positive integers $a,b,c,d$ that satisfies $a\leq b$ and $c\leq d$. He wants to choose two integers $x,y$ that satisfies $a\leq x\leq b$ and $c\leq y\leq d$, and maximize the value of $x~XOR~y$. But he doesn't know how to do it, so please tell him the maximum value of $x~XOR~y$.
输入解释
The first line contains an integer $T\left(1\leq T\leq10,000\right)$——The number of the test cases.
For each test case, the only line contains four integers $a,b,c,d\left(1\leq a,b,c,d\leq10^{18}\right)$. Between each two adjacent integers there is a white space separated.
输出解释
For each test case, the only line contains a integer that is the maximum value of $x~XOR~y$.
输入样例
2
1 2 3 4
5 7 13 15
输出样例
6
11

提示
In the first test case, when and only when $x=2,y=4$, the value of $x~XOR~y$ is the maximum.
In the second test case, when and only when $x=5,y=14$ or $x=6,y=13$, the value of $x~XOR~y$ is the maximum.
来自杭电HDUOJ的附加信息
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5661

最后修改于 2020-10-25T23:24:36+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)