洛谷IDE通过,但是在测试里面只有40. C语言
查看原帖
洛谷IDE通过,但是在测试里面只有40. C语言
799480
kickfox楼主2022/10/6 12:27
#include<stdio.h>
#include<math.h>
int m,n,min,max,i,j,acc,sum,score[20],total_sco=0;
float aver,high_score=0.00;

int main()
{
	scanf(" %d %d ", &n, &m);
	acc = m - 2;
	for( i=0; i<n; i++)
	{
		sum = 0;
        for(j=0; j<m; j++)                 //算出每个同学的平均分; 
		{
			min=score[0];
			max=score[0];
			scanf(" %d ", &score[j]);
    		sum = sum + score[j];
			if( score[j] > max)
            {
				max = score[j];
				
			}
			if( score[j] < min)
			{
				min = score[j];
                
			}
		
		}
		total_sco = sum - max - min;
		aver = total_sco / acc;
        
		if(aver >high_score)
		{
		high_score = aver;
		}
			
	}
	printf("%.2f ",high_score);
}
2022/10/6 12:27
加载中...