#K10296. Maximizing a[0] with Sum Operations
Maximizing a[0] with Sum Operations
Maximizing a[0] with Sum Operations
You are given an array a of n non-negative integers. In one operation, you can add any element of the array to a[0]. You can perform this operation any number of times. The goal is to maximize the value of a[0] after possibly many operations.
Observation: Since there is no restriction on the number of operations, you can add every element (including a[0] itself) exactly once to achieve the maximum possible value of a[0]. Therefore, the maximum value is the sum of all elements in the array.
Task: For each test case, calculate the sum of all numbers in the given array.
Note: All formulas are provided in LaTeX format. For example, the sum is given by: \(a[0]_{\text{max}} = \sum_{i=0}^{n-1} a[i]\).
inputFormat
The first line contains an integer T indicating the number of test cases. For each test case, the first line contains an integer n representing the number of elements in the array. The second line contains n space-separated non-negative integers representing the array a.
Example:
1 5 1 2 3 4 5
outputFormat
For each test case, output a single line containing the maximum possible value of a[0], which is the sum of all the elements in the array.
Example:
15## sample
1
4
0 0 0 0
0
</p>