#K39637. Maximum Possible Sum
Maximum Possible Sum
Maximum Possible Sum
You are given a sequence of n non-negative integers. Your task is to compute the maximum possible sum of the sequence after performing operations that are allowed to increase the sum, while ensuring that all elements remain non-negative. In this problem, it turns out that no operations can actually increase the sum beyond the original elements. Thus, the answer is simply the sum of all the integers in the sequence.
Note: The answer is obtained by calculating the sum of the input numbers.
Examples:
- For input:
5\n1 2 3 4 5
, the output is15
. - For input:
1\n10
, the output is10
. - For input:
4\n1 1 1 1
, the output is4
. - For input:
3\n1000000000 1000000000 1000000000
, the output is3000000000
. - For input:
3\n1 1000000000 1
, the output is1000000002
.
inputFormat
The first line of input contains an integer n representing the number of elements in the sequence. The second line contains n non-negative integers separated by spaces.
Format:
n num1 num2 ... num_n
outputFormat
Output a single integer, the sum of all the numbers in the sequence.
Format:
result## sample
5
1 2 3 4 5
15
</p>