Young Artist Grand Prix _ evaluation board score
Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 46823 accepted submission (s): 23468
In the Problem description young singer Grand Prix, the jury scored the 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.
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 player is retained with two decimal places. Each group of output occupies one row.
Sample input3 99 98 974 100 99 98 97
Sample output98.0098.50
1 #include<cstdio> 2 int main() 3 { 4 int n; 5 while(scanf("%d",&n)==1) 6 { 7 if(n<=2||n>100)return 0; 8 int maxs=0,mins=10000; 9 float sum=0;10 for(int i=0;i<n;i++)11 {12 int mm;13 scanf("%d",&mm);14 if(mins>mm)mins=mm;15 if(maxs<mm)maxs=mm;16 sum=sum+mm;17 }18 sum=(sum-maxs-mins)/(n-2);19 printf("%.2f\n",sum);20 }21 return 0;22 }
Hangzhou (Hangzhou), 2014 19:09:13