Xor is Mad
Practice
3.8 (21 votes)
Bit manipulation
Basic programming
Approved
Easy
Bit manipulation
Problem
81% Success 7630 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

The problem is straight and simple.
Given a number X ,find how many positive A ( \(A\gt 0)\) exists, such that
1. A \(\newcommand*\xor{\mathbin{\oplus}}\) X =A + X
2. A \(\lt\) X
Input:
The first line of the input will contain T , the number of test-cases.
Next T lines will contain integer X .
Output:
For each test-case , output the answer in a separate line.

Constraints:

  • \(1 \le T \le 10^5\)
  • \(1 \le X \le 10^7\)
Note: \(\newcommand*\xor{\mathbin{\oplus}}\) is the bitwise Exclusive-OR operator( XOR ). and + is the usual addition symbol.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
4 votes
Tags:
Special NumbersCountingImplementationMath BasicBasic ProgrammingBasic MathBasics of ImplementationSieveMath
Points:20
94 votes
Tags:
MathematicsOpenApprovedEasy
Points:20
7 votes
Tags:
Dynamic ProgrammingRecursionAlgorithmsEasyMathematicsOpenApproved