1817. geolocation Grand Prix
Description
Each jury in the contestant Grand Prix will rate each contestant. Use the class to describe the ratings of each contestant by the judges. 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. The first behavior data group is T.
The first row of each data group has two positive integers, n m (3 <= n, m <= 100), indicating that there are n evaluation committees and M contestants.
Next n rows, each row has M positive integers. Each row represents the score given to M contestants by a judge. The score is an integer of [0,100.
Output
Output the result to output m rows of input data in each group. Each row indicates the score of a contestant, and the result is retained with two decimal places.
Sample Input
13 41 2 3 41 2 3 41 2 3 4
Sample output
1.002.003.004.00
// Source code of submission 980815, Zhongshan University Online judge system # include <stdio. h> # define maxlen 100int main () {int t, n, m; int I, j; float average; int score [maxlen] [maxlen]; int MAX [maxlen]; int Min [maxlen]; scanf ("% d", & T); While (t --) {scanf ("% d", & N, & M ); for (I = 0; I <m; I ++) {max [I] = 0; Min [I] = 100;} for (I = 0; I <N; I ++) {for (j = 0; j <m; j ++) {scanf ("% d", & score [I] [J]); if (score [I] [J]> MAX [J]) Max [J] = score [I] [J]; if (score [I] [J] <min [J]) min [J] = score [I] [J] ;}} for (j = 0; j <m; j ++) {average = 0; for (I = 0; I <n; I ++) {average + = score [I] [J];} average = (average-MAX [J]-min [J])/(n-2); printf ("%. 2f \ n ", average) ;}} return 0 ;}