305618: CF1064B. Equations of Mathematical Magic
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Equations of Mathematical Magic
题意翻译
## 题目描述 给出 $ a $,判断方程 $ a-(a \oplus x)-x=0 $ 的解的个数。(其中 $ \oplus $ 为异或) ## 输入格式 第一行是数据组数 $ t $,接下来 $ t $ 行每行输入一个整数 $ a $。 ## 输出格式 对于每组数据,输出对应的答案。题目描述
Colossal! — exclaimed Hawk-nose. — A programmer! That's exactly what we are looking for. Arkadi and Boris Strugatsky. Monday starts on Saturday Reading the book "Equations of Mathematical Magic" Roman Oira-Oira and Cristobal Junta found an interesting equation: $ a - (a \oplus x) - x = 0 $ for some given $ a $ , where $ \oplus $ stands for a bitwise exclusive or (XOR) of two integers (this operation is denoted as ^ or xor in many modern programming languages). Oira-Oira quickly found some $ x $ , which is the solution of the equation, but Cristobal Junta decided that Oira-Oira's result is not interesting enough, so he asked his colleague how many non-negative solutions of this equation exist. This task turned out to be too difficult for Oira-Oira, so he asks you to help.输入输出格式
输入格式
Each test contains several possible values of $ a $ and your task is to find the number of equation's solution for each of them. The first line contains an integer $ t $ ( $ 1 \le t \le 1000 $ ) — the number of these values. The following $ t $ lines contain the values of parameter $ a $ , each value is an integer from $ 0 $ to $ 2^{30} - 1 $ inclusive.
输出格式
For each value of $ a $ print exactly one integer — the number of non-negative solutions of the equation for the given value of the parameter. Print answers in the same order as values of $ a $ appear in the input. One can show that the number of solutions is always finite.
输入输出样例
输入样例 #1
3
0
2
1073741823
输出样例 #1
1
2
1073741824