#C1148. Sum of Two Largest Integers
Sum of Two Largest Integers
Sum of Two Largest Integers
You are given an integer \(n\) (with \(n \ge 2\)) and a list of \(n\) integers. Your task is to find the two largest integers in the list and output their sum.
If the list contains fewer than two elements, the problem guarantees that such input will not be provided.
Example: For input 5
and the list [1, 2, 3, 4, 5]
, the two largest integers are \(5\) and \(4\), and their sum is \(9\).
inputFormat
The input consists of two lines. The first line contains an integer \(n\) (\(n \ge 2\)), representing the number of integers. The second line contains \(n\) space-separated integers.
outputFormat
Output a single integer which is the sum of the two largest integers in the list.
## sample5
1 2 3 4 5
9