P18439 [CodeChef] IRSTXOR
普及
题目描述

Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.

Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denotes the bitwise XOR operation). Find the maximum value of $A \cdot B$ over all these pairs.

------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains a single integer $C$.

------ Output ------
For each test case, print a single line containing one integer ― the maximum possible product $A \cdot B$.

------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ C ≤ 10^{9}$

------ Subtasks ------
Subtask #1 (30 points): $1 ≤ C ≤ 10^{3}$

Subtask #2 (70 points): original constraints

----- Sample Input 1 ------
2

13

10
----- Sample Output 1 ------
70

91
----- explanation 1 ------
Example case 1: The binary representation of $13$ is "1101". We can use $A = 10$ ("1010" in binary) and $B = 7$ ("0111" in binary). This gives us the product $70$. No other valid pair $(A, B)$ can give us a larger product.

Example case 2: The binary representation of $10$ is "1010". We can use $A = 13$ ("1101") and $B = 7$ ("0111"). This gives us the maximum product $91$.

输入格式

见题面

输出格式

见题面

样例输入
2 13 10
样例输出
70 91