309490: CF1688A. Cirno's Perfect Bitmasks Classroom

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Cirno's Perfect Bitmasks Classroom

题意翻译

**题目描述** > 就算是很简单的问题,她一定也答不上来。——《东方求闻史纪》 琪露诺的完美位运算教室开始了! 琪露诺给了她的学生一个正整数 $x$,作为作业题,她的学生需要找到一个满足以下两个条件的,最小的正整数 $y$。 - $x \operatorname{and} y>0$ - $x \operatorname{xor} y>0$ 这里的 $\operatorname{and}$ 和 $\operatorname{xor}$ 都是位运算。 她的学生米斯蒂娅对这个问题束手无策,请你来帮帮她。 **输入格式** 第一行输入一个正整数 $t(1 \leq t \leq 10^3)$,表示输入数据组数。 对于每一组数据,输入一个正整数 $x$。 **输出格式** 对于每一组数据,输出符合题目要求的 $y$。

题目描述

Even if it's a really easy question, she won't be able to answer it — Perfect Memento in Strict Sense Cirno's perfect bitmasks classroom has just started! Cirno gave her students a positive integer $ x $ . As an assignment, her students need to find the minimum positive integer $ y $ , which satisfies the following two conditions: $$x\ \texttt{and}\ y > 0 $$ $$x\ \texttt{xor}\ y > 0 $$ Where $\texttt{and}$ is the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND), and $\texttt{xor}$ is the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). Among the students was Mystia, who was truly baffled by all these new operators. Please help her!

输入输出格式

输入格式


The first line of input contains a single integer $ t $ ( $ 1 \leq t \leq 10^3 $ ) — the number of input test cases. For each test case, the only line of input contains one integer $ x $ ( $ 1 \leq x \leq 2^{30} $ ).

输出格式


For each test case, print a single integer — the minimum number of $ y $ .

输入输出样例

输入样例 #1

7
1
2
5
9
16
114514
1000000

输出样例 #1

3
3
1
1
17
2
64

说明

Test case 1: $ 1\; \texttt{and}\; 3=1>0 $ , $ 1\; \texttt{xor}\; 3=2>0 $ . Test case 2: $ 2\; \texttt{and}\; 3=2>0 $ , $ 2\; \texttt{xor}\; 3=1>0 $ .

Input

题意翻译

**题目描述** > 就算是很简单的问题,她一定也答不上来。——《东方求闻史纪》 琪露诺的完美位运算教室开始了! 琪露诺给了她的学生一个正整数 $x$,作为作业题,她的学生需要找到一个满足以下两个条件的,最小的正整数 $y$。 - $x \operatorname{and} y>0$ - $x \operatorname{xor} y>0$ 这里的 $\operatorname{and}$ 和 $\operatorname{xor}$ 都是位运算。 她的学生米斯蒂娅对这个问题束手无策,请你来帮帮她。 **输入格式** 第一行输入一个正整数 $t(1 \leq t \leq 10^3)$,表示输入数据组数。 对于每一组数据,输入一个正整数 $x$。 **输出格式** 对于每一组数据,输出符合题目要求的 $y$。

Output

**题目大意**

琪露诺的完美位运算教室开课了!她给学生们一个正整数 $x$ 作为作业,要求他们找到一个最小的正整数 $y$,满足以下两个条件:

1. $x$ 和 $y$ 进行位与操作($\text{and}$)的结果大于 0。
2. $x$ 和 $y$ 进行位异或操作($\text{xor}$)的结果大于 0。

需要帮助琪露诺的学生米斯蒂娅解决这个问题。

**输入输出数据格式**

**输入格式:**
- 第一行输入一个正整数 $t$($1 \leq t \leq 10^3$),表示测试用例的数量。
- 接下来的每一行输入一个正整数 $x$($1 \leq x \leq 2^{30}$)。

**输出格式:**
- 对于每个测试用例,输出一个满足条件的最小正整数 $y$。

**输入输出样例**

**输入样例 #1:**
```
7
1
2
5
9
16
114514
1000000
```

**输出样例 #1:**
```
3
3
1
1
17
2
64
```

**说明**

例如,第一个测试用例中:
- $1 \; \text{and} \; 3 = 1 > 0$
- $1 \; \text{xor} \; 3 = 2 > 0$

第二个测试用例中:
- $2 \; \text{and} \; 3 = 2 > 0$
- $2 \; \text{xor} \; 3 = 1 > 0$**题目大意** 琪露诺的完美位运算教室开课了!她给学生们一个正整数 $x$ 作为作业,要求他们找到一个最小的正整数 $y$,满足以下两个条件: 1. $x$ 和 $y$ 进行位与操作($\text{and}$)的结果大于 0。 2. $x$ 和 $y$ 进行位异或操作($\text{xor}$)的结果大于 0。 需要帮助琪露诺的学生米斯蒂娅解决这个问题。 **输入输出数据格式** **输入格式:** - 第一行输入一个正整数 $t$($1 \leq t \leq 10^3$),表示测试用例的数量。 - 接下来的每一行输入一个正整数 $x$($1 \leq x \leq 2^{30}$)。 **输出格式:** - 对于每个测试用例,输出一个满足条件的最小正整数 $y$。 **输入输出样例** **输入样例 #1:** ``` 7 1 2 5 9 16 114514 1000000 ``` **输出样例 #1:** ``` 3 3 1 1 17 2 64 ``` **说明** 例如,第一个测试用例中: - $1 \; \text{and} \; 3 = 1 > 0$ - $1 \; \text{xor} \; 3 = 2 > 0$ 第二个测试用例中: - $2 \; \text{and} \; 3 = 2 > 0$ - $2 \; \text{xor} \; 3 = 1 > 0$

加入题单

算法标签: