You are provided an array
The formula for your score in each round is =
RoundNumber will start from
Input Format:
- The first line contains an integer
, where denotes the size of the array . - The second line contains an interger
.
Output Format:
- Print the maximum possible final score.
Constraints:
4 3 4 5 9 2
9
Example:
RoundNumber = 1, choose {3,9}, Score = 1*(3&9) = 1*(1) = 1.
RoundNumber = 2, choose {4,5}, Score = 2*(4&5) = 2*(4) = 8.
Final score = 1 + 8 = 9. The maximum possible final score is 9.
Please login to use the editor
You need to be logged in to access the code editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor