当前位置:网站首页>C193: scoring system

C193: scoring system

2022-07-27 20:01:00 Qiangan

Title Description :

Design a scoring system for singing competitions , The following rules :
share n Judges give points (0~100 branch , Integers ), Ask to remove one of the highest scores , Remove a minimum score , The average score of the remaining grades is the final score .

Enter a positive integer n(3≤n≤10), Express n Judges , Input n Achievements , Output the final score .

Input format :

Enter a positive integer in the first line n(3≤n≤10), On the second line, enter the score given by each judge , Separate... With spaces .

Output format :

Output the final score , Two decimal places are reserved for the result .

Example :

Input :5
70 75 80 85 90
Output :80.00

#include<stdio.h>
int main()
{
    
	int p[10],n,i,min=100,max=0;
	float z;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&p[i]);
	for(i=0;i<n;i++)
	{
    
		z+=p[i];
		if(p[i]<min) min=p[i];
		if(p[i]>max) max=p[i];
	}
	z=(z-min-max)/(n-2);
	printf("%.2f",z);
	return 0;
}
原网站

版权声明
本文为[Qiangan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/208/202207271717046308.html