W.C 2.2 The Promotion

Promotion Dwight Schrute is given a sequence of T integers by office manager Micheal Scott. In order to get promoted , Micheal has tasked him to find the sum of Xa $ Xb for all the pairs (a,b)
in the sequence where a is less than b.

Help Dwight to get promoted.
Note: The $ represents bitwise(logical) AND.

Input :
The first line contains no. of integers T in the sequence.
The second line consists of n spaced integers.

Testcases : link
Answer for each testcase is sum mod 101.
Give final answer as sum of all answers.

Example:
Input:
4
1 9 6 7

Output:
9

Explanation:

Pair 1 : {1 AND 9} =1
Pair 2 : {1 AND 6} =0
Pair 3 : {1 AND 7} =1
Pair 4 : {9 AND 6} =0
Pair 5 : {9 AND 7} =1
Pair 6 : {6 AND 7} =6

Total = 9%101 = 9

This challenge is worth 60 points.

You must be logged in to submit a solution

View ranklist for this challenge
About scoring and submission

Contact Us


Kunal Desai : 7715051136

Neelraj Patil : 9930671144



Privacy Policy