Loading Similar Posts
The Minimum Sum
You are given an array A of size n with positive and negative integers. You are also given an Integer x.
You can repeat this process any number of times (>=0).
Note : A[i] / x is a floating-point division.
Your task is to minimize the sum of the final array and print the minimum sum.
Input format
Output format
Print the minimum sum.
1 ≤ n ≤ 106
0 ≤ |A[i]| ≤ 109
1 ≤ x ≤ 109
Sample input
5 1
1 2 3 4 5
Sample output
15
any other questions ??