2014.cpp

来自「威士忌的HDU题解.大概有260多题的源码。对于学习非常有好处。」· C++ 代码 · 共 43 行

CPP
43
字号
/*
2014 青年歌手大奖赛_评委会打分
Time Limit : 1000 ms  Memory Limit : 32768 K  Output Limit : 256 K

GUN C++
*/
#include <iostream.h>
using namespace std;

#define MAX 1000

int main()
{
    int n,ca,max,min,score,all;
    cout.setf(ios::fixed);
    cout.precision(2);
    while(cin>>n)
    {
        if(n<3)
            continue;
        cin>>score;
        max=score;
        cin>>score;
        if(score>max)
        {   min=max;max=score;}
        else
        {   min=score;}
        all=0;
        for(ca=2;ca<n;ca++)
        {
            cin>>score;
            if(score>max)
            {   all+=max;max=score;continue;}
            if(score<min)
            {   all+=min;min=score;continue;}
            all+=score;
        }
        cout<<1.0*all/(n-2)<<endl;
    }
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?