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

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
26 votes
Tags:
Basic ProgrammingBit ManipulationBit manipulationEasy
Points:20
2 votes
Tags:
Bit ManipulationBasics of Bit ManipulationBasic Programming
Points:20
10 votes
Tags:
ApprovedBasic ProgrammingBit manipulationEasyGrammar-VerifiedImplementationPriority queueReadyRecruit