CF1688A.Cirno's Perfect Bitmasks Classroom

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

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\\ \\texttt{and}\\ y \\gt 0$$ $$x\\ \\texttt{xor}\\ y \\gt 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!

即使这是一道非常简单的题目,她也无法回答。

——《严格意义下的完美记忆》

琪露诺的完美位运算课堂刚刚开始!

琪露诺给了她的学生们一个正整数 xx。作为课后作业,学生们需要找出满足以下两个条件的最小正整数 yy:

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

其中 and\texttt{and} 表示按位与运算,xor\texttt{xor} 表示按位异或运算。

学生中有一位名叫 Mystia 的同学,面对这些全新的运算符完全不知所措。请帮帮她!

输入格式

The first line of input contains a single integer tt (1≤t≤1031 \leq t \leq 10^3) — the number of input test cases.

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

输入的第一行包含一个整数 tt(1≤t≤1031 \leq t \leq 10^3)—— 表示输入测试用例的数量。

对于每个测试用例,输入的唯一一行包含一个整数 xx(1≤x≤2301 \leq x \leq 2^{30})。

输出格式

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

对于每个测试用例,输出一个整数——即 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 \gt 0, 1  xor  3=2>01\; \texttt{xor}\; 3=2 \gt 0.

Test case 2:

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

测试用例 1:

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

测试用例 2:

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

输入解题思路,AI测评打分。不知道怎么写?

首页