CF1064B Equations of Mathematical Magic

题目描述

给出 $ a $,判断方程 $ a-(a \oplus x)-x=0 $ 的解的个数。(其中 $ \oplus $ 为异或)

输入格式

第一行是数据组数 $ t $,接下来 $ t $ 行每行输入一个整数 $ a $。

输出格式

对于每组数据,输出对应的答案。

说明/提示

Let's define the bitwise exclusive OR (XOR) operation. Given two integers $ x $ and $ y $ , consider their binary representations (possibly with leading zeroes): $ x_k \dots x_2 x_1 x_0 $ and $ y_k \dots y_2 y_1 y_0 $ . Here, $ x_i $ is the $ i $ -th bit of the number $ x $ and $ y_i $ is the $ i $ -th bit of the number $ y $ . Let $ r = x \oplus y $ be the result of the XOR operation of $ x $ and $ y $ . Then $ r $ is defined as $ r_k \dots r_2 r_1 r_0 $ where: $ $$$ r_i = \left\{ \begin{aligned} 1, ~ \text{if} ~ x_i \ne y_i \\ 0, ~ \text{if} ~ x_i = y_i \end{aligned} \right. $ $

For the first value of the parameter, only $ x = 0 $ is a solution of the equation.

For the second value of the parameter, solutions are $ x = 0 $ and $ x = 2$$$.