#K11746. Average Score Calculation
Average Score Calculation
Average Score Calculation
You are given a list of integer scores. Your task is to compute the average score after removing the two lowest scores. If there are fewer than three scores, the result should be 0.0.
To solve the problem, first sort the scores in non-decreasing order, then remove the two smallest values. Compute the average of the remaining scores using the formula:
\[ \text{Average} = \frac{\sum_{i=3}^{n} s_i}{n-2} \]
The final result must be rounded to two decimal places if necessary. Note that if the decimal part is zero, output it with one decimal (for example, 80.0).
inputFormat
The first line contains an integer n
representing the number of scores. The second line contains n
space-separated integers, each representing a score.
outputFormat
Output a single number which is the average score after dropping the two lowest scores. If there are fewer than three scores, output 0.0
. The output should print one decimal place if the fractional part is zero, otherwise, round to two decimal places.
5
50 80 90 20 70
80.0