Chef Find XOR Beautiful Solution | CodeChef Problem Solution 2022
You are given an array of size and an integer .
Find the count of all the pairs such that . Here and denote bitwise XOR and bitwise AND operations respectively.
Input Format
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first line of each test case contains a single integer - the size of the array.
- The second line contains space-separated integers - the elements of the array.
- The third line of each test case contains a single integer .
Output Format
For each test case, print a single line containing one integer ― the total number of pairs satisfying the condition.
Constraints
Sample Input 1
2
4
1 2 3 1
1
3
0 0 0
21
Sample Output 1
10
9
Explanation
Test case : There are pairs of satisfying the condition. These pairs are: and .
Test case : There are pairs of satisfying the condition. These pairs are: and .
No comments:
Post a Comment