P5726 [Deep Base 4. Exercise 9] Scoring.
Description
There are $n(n \le 1000)$ judges scoring a contestant, with scores ranging from $0$ to $10$. You need to remove one highest score and one lowest score (if there are multiple highest or lowest scores, only remove one), and the average of the remaining scores is the contestant’s final score. Given the number of judges and their scores, output the contestant’s final score, accurate to $2$ decimal places.
Input Format
The first line contains a positive integer $n$, indicating that there are $n$ judges.
The second line contains $n$ integers. The $i$-th integer is the score given by the $i$-th judge.
Output Format
Output one line with a number rounded to two decimal places, representing the contestant’s final score.
Explanation/Hint
Constraints: the data guarantees that $3 \leq n \leq 1000$, and each judge’s score is an integer between $0$ and $10$ (inclusive of $0$ and $10$).
Translated by ChatGPT 5