CF1688A.Cirno's Perfect Bitmasks Classroom

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 xx . As an assignment, her students need to find the minimum positive integer yy , which satisfies the following two conditions:

x and y>0x\ \texttt{and}\ y > 0

x xor y>0x\ \texttt{xor}\ y > 0

Where and\texttt{and} is the bitwise AND operation, and xor\texttt{xor} is the bitwise XOR operation.

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 tt ( 1t1031 \leq t \leq 10^3 ) — the number of input test cases.

For each test case, the only line of input contains one integer xx ( 1x2301 \leq x \leq 2^{30} ).

输出格式

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

输入输出样例

  • 输入#1

    7
    1
    2
    5
    9
    16
    114514
    1000000

    输出#1

    3
    3
    1
    1
    17
    2
    64

说明/提示

Test case 1:

1  and  3=1>01\; \texttt{and}\; 3=1>0 , 1  xor  3=2>01\; \texttt{xor}\; 3=2>0 .

Test case 2:

2  and  3=2>02\; \texttt{and}\; 3=2>0 , 2  xor  3=1>02\; \texttt{xor}\; 3=1>0 .

首页