HDoj 2014 青年歌手大奖赛_评委会打分

Problem Description
青年歌手大奖赛中,评委会给参赛选手打分。选手得分规则为去掉一个最高分和一个最低分,然后计算平均得分,请编程输出某选手的得分。
 

 

Input
输入数据有多组,每组占一行,每行的第一个数是n(2<n<=100),表示评委的人数,然后是n个评委的打分。
 

 

Output
对于每组输入数据,输出选手的得分,结果保留2位小数,每组输出占一行。
 

 

Sample Input
3 99 98 97 4 100 99 98 97
 

 

Sample Output
98.00 98.50
 

 

Author
lcy
 

 

Source
 

 

Recommend
lcy   |   We have carefully selected several similar problems for you:  2015 2017 2016 2018 2020 
 
 
#include<stdio.h>
int main()
{
    double s,max,min,score;
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        s=0;
        max=0;
        min=200;
        for(int i=0;i<n;i++)
        {
            scanf("%lf",&score);
            if(score>max)
                max=score;
            if(score<min)
                min=score;
            s+=score;
        }
        printf("%.2f\n",(s-min-max)/(n-2));
    }
}

 

posted on 2020-03-17 18:59  沈香茶  阅读(110)  评论(0)    收藏  举报