← 返回 amazon 的题目列表Maximum Reward Points
类型:online_judge
amazon
Amazon shopping periodically has offers to attract more customers.
Suppose the store has n items in its inventory, and every time the item i is purchased, the customer gains points[i] as reward. After the purchase, points[i] becomes points[i] // 2. You need to find the maximum total reward points that can be obtained.
Note: Each item can be bought multiple times as long as the points are greater than 0.
Input Format:
int n: number of items
int[] points: initial points for each item, where points[i] >= 0
Output Format:
int: maximum reward points obtainable
Constraints:
1 <= n <= 10^5
Example: For example points array [5, 2, 2, 3, 1], the maximum reward points obtainable is 7.
Example
Input
5
5 2 2 3 1