#P16277. 「MierOI R1」Past

「MierOI R1」Past

Problem Description

Given a positive integer nn, determine whether there exist a palindromic number^{\bm{\dagger}} aa and a non-negative integer bb such that a+2b=na+2^b=n.


\bm \dagger A non-negative integer is called a palindromic number if and only if it reads the same forwards and backwards.

Input Format

This problem contains multiple test cases.

The first line of the input contains a positive integer TT, indicating the number of test cases.

Then, the TT test cases follow sequentially. For each test case:

  • One line containing a single positive integer nn.

Output Format

For each test case, output a single line:

  • If there exist a,ba,b satisfying the condition, output Yes.
  • If there do not exist a,ba,b satisfying the condition, output No.
3
15
1022
58187
Yes
No
Yes

Hint

Explanation for Sample #1

For the first test case, we have a=11a=11, b=2b=2, and n=11+22=15n=11+2^2=15.

For the second test case, it can be proven that there do not exist a,ba,b satisfying the conditions.

For the third test case, we have a=57675a=57\,675, b=9b=9, and n=57675+29=58187n=57\,675+2^9=58\,187.

Data Range

This problem uses bundled subtasks.

For all test cases, it is guaranteed that 1T1041 \le T \le 10^4 and 1n10181 \le n \le 10^{18}.

::cute-table{tuack}

Subtask TT \le nn \le Score
11 1010 10310^3 3030
22 ^ 10610^6
33 10410^4 101810^{18} 4040