Codeforces Round 1058 (Div. 2)
C
Reverse XOR
Codeforces
1300
原题
← BD →
翻译中…

Given a positive integer $x$, let $f(x)$ be the positive integer formed by reversing the binary representation of $x$ without leading zeroes. For example, if $x=12=1100_2$, then $f(x)=0011_2=3$.

翻译中…

You are given an integer $n$. Please determine if there exists a positive integer $x$ such that $x \oplus f(x) = n$$^{\text{∗}}$.

翻译中…

$^{\text{∗}}$Here, $\oplus$ denotes the bitwise XOR operation.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The first line of each test case contains an integer $n$ ($0 \leq n \lt 2^{30}$).

翻译中…

Output

翻译中…

For each test case, output YES if there exists a positive integer $x$ such that $x \oplus f(x) = n$, and NO otherwise.

翻译中…

You can output the answer in any case. For example, the strings "yEs", "yes", and "Yes" are also recognized as positive responses.

翻译中…

Note

翻译中…

In the first case, when $x=1$, $f(x)=1$, and $x \oplus f(x)=0$. Thus, the answer is YES.

翻译中…

In the second case, when $x=2$, $f(x)=1$, and $x \oplus f(x)=3$. Thus, the answer is YES.

翻译中…

In the fourth test case, we can show there is no $x$ that satisfies $x \oplus f(x)=8$, so the answer is NO.

翻译中…

样例

Input #1
6
0
3
6
8
10
11
Output #1
YES
YES
YES
NO
YES
NO
InputCopy OutputCopy
题目信息
题号
2160C
时间限制
2 s
内存限制
256 MB
标签
位运算

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。