1149:0 starting point algorithm 56--young singer Grand Prix _ Jury rating time limit:1 Sec Memory limit:64 MB 64bit IO Format:%lld
submitted:1116 accepted:755
[Submit] [Status] [Web Board] Description
In 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.
Input
In 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.
Output
For each set of input data, the output contestant's score, the result retains 2 decimal places, each set of output occupies one row.
Sample Input
3 99 98 974 100 99 98 97
Sample Output
98.0098.50
Source
0 Starting point Learning algorithm
1#include <stdio.h>2 intMain () {3 intn,a[ -],b[ -];4 while(SCANF ("%d", &n)! =EOF) {5 for(intI=0; i<n;i++){6scanf"%d",&a[i]);7 }8 9 intmax=a[0],min=a[0];Ten for(intI=0; i<n;i++){ One if(a[i]>max) Amax=A[i]; - if(a[i]<min) -min=A[i]; the } - ints=0; - for(intI=0; i<n;i++){ - if(a[i]!=max&&a[i]!=min) +s+=A[i]; - } + Aprintf"%.2f\n",1.0*s/(n2)); at } - return 0; -}
1149:0 starting point algorithm 56--young singer Grand Prix _ jury rating