The simple rules for students to evaluate each other's work are as follows: Everyone's homework will be judged by the K-students and get K scores. The system needs to get rid of a maximum score and a minimum score, and the remaining scores are averaged to obtain the student's final result. The subject asks you to write the calculation sub-module of this mutual evaluation system.
Input format:
Enter the first line to give 3 positive integers n (3< n <=4, total students), K (3<= K <= 10, number of reviews per job), M (<= 20, number of students to be output). Then n lines, each row gives a job to get the K evaluation results (in the interval [0, 100], in the meantime separated by a space.)
Output format:
Outputs the highest scored m scores in non-descending order, preserving 3 digits after the decimal point. There are 1 spaces between the scores and no extra spaces at the end of the line.
Input Sample:
6 5 388 90 85 99 6067 60 80 76 7090 93 96 99 9978 65 77 70 7288 88 88 88 8855 55 55 55 55
Sample output:
87.667 88.000 96.000
#include <stdio.h>
#include <string.h>
#include <math.h>
int a[10000][10],sum[10000],max[10000],min[10000];
int main ()
{
int m,n,t,i,j,temp;
memset (sum,0,sizeof (sum));
memset (max,0,sizeof (max));
memset (min,100,sizeof (min));
scanf ("%d%d%d", &m,&n,&t);
for (i=0;i<m;i++)
{
for (j=0;j<n;j++)
{
scanf ("%d", &a[i][j]);
SUM[I]+=A[I][J];
if (Max[i]<a[i][j])
{
MAX[I]=A[I][J];
}
if (Min[i]>a[i][j])
{
MIN[I]=A[I][J];
}
}
}
for (i=0;i<m;i++)
{
Sum[i]-=max[i]+min[i];
}
for (i=0;i<m-1;i++)
{
for (j=0;j<m-1-i;j++)
{
if (sum[j]<sum[j+1])
{
TEMP=SUM[J];
SUM[J]=SUM[J+1];
Sum[j+1]=temp;
}
}
}
for (i=t-1;i>0;i--)
{
printf ("%.3f", sum[i]*1.0/(n-2));
}
printf ("%.3f\n", sum[0]*1.0/(n-2));
return 0;
}
l2-015. Mutual assessment Results