#K11686. Top Two Scores
Top Two Scores
Top Two Scores
You are given an array of unique integers representing scores. Your task is to identify the highest score, the second highest score, and compute the sum of these two scores.
If the array contains fewer than two scores, output the error message exactly as:
The array must contain at least two scores.
The input will be provided via standard input and the output must be printed to standard output.
Note: The array is not necessarily sorted.
inputFormat
The first line contains a single integer n (n ≥ 1) representing the number of scores. The second line contains n space-separated integers. It is guaranteed that if n ≥ 2, the scores are unique.
outputFormat
If the number of scores is at least 2, output three integers separated by spaces: the highest score, the second highest score, and the sum of the two scores. If the input does not contain at least two scores, output the following error message exactly:
The array must contain at least two scores.
5
1 2 3 4 5
5 4 9
</p>