Sherlock and XOR
Practice
3.8 (63 votes)
Approved
Basic programming
Easy
Math
Open
Problem
84% Success 31378 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code
You are given an array A1,A2...AN. You have to tell how many pairs (i, j) exist such that 1 ≤ i < j ≤ N and Ai XOR Aj is odd.
Input and Output
First line T, the number of testcases. Each testcase: first line N, followed by N integers in next line. For each testcase, print the required answer in one line.
Constraints
1 ≤ T ≤ 10
1 ≤ N ≤ 105
0 ≤ Ai ≤ 109
Submissions
Please login to view your submissions
Similar Problems
Points:20
156 votes
Tags:
Ad-HocApprovedBit manipulationEasyOpen
Points:20
14 votes
Tags:
Basics of bit manipulationBitmaskImplementationMerge SortBit ManipulationAlgorithmsBasic ProgrammingSortingBasics of Bit Manipulation
Points:20
9 votes
Tags:
Basic ProgrammingBit ManipulationBasics of Bit Manipulation
Editorial