AND Sum
Practice
4 (21 votes)
Basic programming
Bit manipulation
Bit manipulation
Easy
Math
Problem
13% Success 8033 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
29 votes
Tags:
BitmaskBasic ProgrammingBit ManipulationBasics of Bit ManipulationGreedy AlgorithmsBit manipulation
2.Subarray
Points:20
6 votes
Tags:
Basics of Input/OutputBit ManipulationBasic ProgrammingInput/OutputBasics of Bit Manipulation
Points:20
35 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyOpen
Editorial