problem DescriptionIn the young Singers ' Grand Prix, the jury graded the contestants. The player scoring rule is to remove a maximum score and a minimum score, and then calculate the average score, please program to output a player's score.
InputThere are several groups of input data, one row per group, the first number of each row is n (2<n<=100), the number of judges, and then the score of N judges.
OutputFor each set of input data, the output contestant's score, the result retains 2 decimal places, each set of output occupies one row.
Sample Input3 99 98 97 4 100 99 98 97
Sample OutputThe 98.00 98.50 code is as follows:
1#include <cstdio>2 intMain () {3 intn,score[ the],temp;4 DoubleAve=0;5 while(SCANF ("%d", &n)! =EOF) {6 for(intI=0; i<n;i++){7scanf"%d",&score[i]);8 }9 for(intI=0; i<n-1; i++){Ten for(intj=0; j<n-1-i;j++){ One if(score[j]>score[j+1]){ Atemp=Score[j]; -score[j]=score[j+1]; -score[j+1]=temp; the } - } - } - for(intk=1; k<n-1; k++){ +ave+=Score[k]; - } +ave=ave/(n2); Aprintf"%.2lf\n", ave); atAve=0; - } - return 0; -}
Analysis of Ideas
I'm slacking off today. So tired to say. A more water problem.
hdu_2014 Young singer Grand Prix _ jury rating