XOR split
Practice
3.4 (12 votes)
Bit manipulation
Basic programming
Basics of bit manipulation
Problem
24% Success 5857 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code
You are given a number \(N\). Your task is to find if there exist two distinct natural numbers such that their bitwise \(XOR\) is \(N\) and bitwise \(AND\) is \(0\). If such numbers exist, then print \(1\). Otherwise, print \(0\).
Input format
- The first line contains \(T\) denoting the number of test cases.
- The first line of each test case contains an integer \(N\).
Output format
For each test case, print the answer.
Constraints
\(1 \leq T \leq 10^6\)
\(0 \leq N \leq 10^{18}\)
Submissions
Please login to view your submissions
Similar Problems
Points:20
15 votes
Tags:
SortingBasic ProgrammingBit ManipulationMerge SortBasics of Bit ManipulationAlgorithmsBit manipulationBitmask
Points:20
156 votes
Tags:
Ad-HocApprovedBit manipulationEasyOpen
Points:20
10 votes
Tags:
ApprovedBasic ProgrammingBit manipulationEasyGrammar-VerifiedImplementationPriority queueReadyRecruit
Editorial