P22346 [CodeChef] XORMUL
提高-
题目描述

JJ has three integers N, A and B where 0 ≤ A, B < 2^{N}. He wants to find a third integer X such that:
0 ≤ X < 2^{N}
the value of $(A \oplus X) \times (B \oplus X)$ is maximum.

Here $\oplus$ represents the [Bitwise XOR] operator.

Can you help him find such an integer X? If there are multiple integers which satisfy the given conditions, print any.

------ Input Format ------

  • The first line will contain T - number of test cases. Then the test cases follow.
  • The first and only line of each test case contains three integers N, A and B - the integers mentioned in the problem statement.

------ Output Format ------

For each test case, output an integer X which satisfies the given conditions.

If multiple answers exist, print any.

------ Constraints ------

$1 ≤ T ≤ 5000$
$1 ≤N ≤30$
$0 ≤A, B < 2^{N}$

----- Sample Input 1 ------
3
1 0 0
3 4 6
2 2 1

----- Sample Output 1 ------
1
3
0

----- explanation 1 ------
Test case 1: For $X = 1$, $(0 \oplus 1) \times (0 \oplus 1) = 1$ which can be proven to be the maximum value of this expression.

Test case 2: For $X = 3$, $(4 \oplus 3) \times (6 \oplus 3) = 35$ which can be proven to be the maximum value of this expression.

输入格式

见题面

输出格式

见题面

样例输入
3 1 0 0 3 4 6 2 2 1
样例输出
1 3 0