AND Sum
Practice
4 (21 votes)
Basic programming
Bit manipulation
Bit manipulation
Easy
Math
Problem
13% Success 8032 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Given an array of N numbers, you have to report the Sum of bitwise AND of all possible subsets of this array. As answer can be large, report it after taking mod with 109+7.
Input:
First line contains a number T denoting the number of test cases.
First line of each test case contains a number N denoting the number of elements in the array.
Second line contains the N elements of the array.
Output:
For each test case output a single number denoting the Sum of bitwise AND of all possible subsets of the given array.
Input Constraints:
1<=T<=10
1<=N<=105
1<=a[i]<=109
Submissions
Please login to view your submissions
Similar Problems
Points:20
71 votes
Tags:
Basic ProgrammingBit ManipulationBit manipulationMath
Points:20
156 votes
Tags:
Ad-HocApprovedBit manipulationEasyOpen
Points:20
26 votes
Tags:
Basic ProgrammingBit ManipulationBit manipulationEasy
Editorial