2014 young artist contest AC and 2014 artist contest
Young Artist Grand Prix _ evaluation board score
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission (s): 56915 Accepted Submission (s): 28404
Problem Description
During the young singer Grand Prix, the jury scored contestants. The contestant scoring rule is to remove one highest score and one lowest score, and then calculate the average score. program the score of a contestant.
Input
There are multiple groups of input data. Each group occupies one row. The first number of each row is n (2 <n <= 100), which indicates the number of judges and then scores of n judges.
Output
For each group of input data, the score of the output contestant is retained with two decimal places in the result, and each group of output occupies one row.
Sample Input
3 99 98 97
4 100 99 98 97
Sample Output
98.00
98.50
Author
Lcy
Source
C language programming exercises (III)
Recommend
Lcy
# Include <stdio. h>
# Include <stdlib. h>
Int main ()
{
Float aver, a [100], sum, max, min;
Int I, n;
While (scanf ("% d", & n )! = EOF)
{
Sum = 0; aver = 0;
For (I = 0; I <n; I ++)
Scanf ("% f", & a [I]);
Max = a [0];
Min = a [0];
For (I = 0; I <n; I ++)
{
If (a [I]> max)
Max = a [I];
If (a [I] <min)
Min = a [I];
Sum + = a [I];
}
Aver = (sum-max-min)/(n-2 );
Printf ("%. 2f \ n", aver );
}
}