cswork / OA打开练习工作台

IBMOA #49

Max XOR

估计简单可在线判题

考点(AI 标注)位运算

Choose lo≤a<b≤hi such that a XOR b≤k and the XOR value is as large as possible; return the XOR value. The two integers must be different; if no feasible pair exists, this site outputs -1.

输入格式

One line containing lo hi k. Full source ranges: 1≤lo<hi≤10000, 1≤k≤10000.

输出格式

Output one integer, the answer.

样例 1

输入:

3 5 6

输出:

6

样例 2

输入:

1 2 1

输出:

-1

样例 3

输入:

1 4 7

输出:

7

样例说明

The examples give 6, -1 and 7 respectively.