#C1162. Maximum Possible Value
Maximum Possible Value
Maximum Possible Value
Given an array of integers, you are allowed to perform a series of operations to merge its elements. In each operation, you can select any two elements and replace them with their sum. Your task is to determine the maximum possible value in the array after performing any number of these operations. In essence, this simply means computing the sum of all the elements.
Formally, if an array \(A = [a_1, a_2, \dots, a_n]\) is given, you need to calculate:
[ \text{max_possible_value}(A) = \sum_{i=1}^{n} a_i ]
Example: For an array [1, 2, 3], the maximum possible value after merging is 6.
inputFormat
The first line contains an integer T representing the number of test cases. Each test case consists of two lines:
- The first line contains an integer N, the number of elements in the array.
- The second line contains N space-separated integers representing the array elements.
outputFormat
For each test case, output a single line containing the maximum possible value that can be obtained by merging the array elements.## sample
1
3
1 2 3
6
</p>