hdu2309ICPC Score Totalizer Software

Problem Description

The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. 
One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one contestant to another, because judges with any relationship whatsoever with a specific contestant are temporarily excluded for scoring his/her performance.

Basically, scores given to a contestant‘s performance by the judges are averaged to decide his/her score. To avoid letting judges with eccentric viewpoints too much influence the score, the highest and the lowest scores are set aside in this calculation. If the same highest score is marked by two or more judges, only one of them is ignored. The same is with the lowest score. The average, which may contain fractions, are truncated down to obtain final score as an integer.

You are asked to write a program that computes the scores of performances, given the scores of all the judges, to speed up the event to be suited for a TV program.

Input

The input consists of a number of datasets, each corresponding to a contestant‘s performance. There are no more than 20 datasets in the input.

A dataset begins with a line with an integer n, the number of judges participated in scoring the performance (3 ≤ n ≤ 100). Each of the n lines following it has an integral score s (0 ≤ s ≤ 1000) marked by a judge. No other characters except for digits to express these numbers are in the input. Judges‘ names are kept secret.

The end of the input is indicated by a line with a single zero in it.

Output

For each dataset, a line containing a single decimal integer indicating the score for the corresponding performance should be output. No other characters should be on the output line.

Sample Input

3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
353
242
402
274
283
132
402
523
0

Sample Output

342
7
300
326

Source

Japan 2007 Domestic

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>

using namespace std;

int main()
{
    int n,i,j,k;
    int sum;
    while(scanf("%d",&n)!=EOF,n)
    {
        sum = 0;
        int mx = 0,mi = 1100;
        for(i = 0;i<n;i++)
        {
            int a;
            scanf("%d",&a);
            mi = min(mi,a);
            mx = max(mx,a);
            sum += a;
        }
        cout<<(sum-mx-mi)/(n-2)<<endl;
    }
    return 0;
}
时间: 2024-08-09 02:27:15

hdu2309ICPC Score Totalizer Software的相关文章

POJ 3325 ICPC Score Totalizer Software(水题)

[题意简述]:去掉一个最高分,去掉一个最低分,求平均分. [分析]:此题和POJ3507其实质是一样的. //732K 32Ms #include<iostream> #include<cmath> #include<algorithm> using namespace std; int score[101];//成绩 int main() { int t; int sum; while(1) { sum = 0; cin>>t; if(t == 0) br

HDOJ(HDU) 2309 ICPC Score Totalizer Software(求平均值)

Problem Description The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business. One of the unique features of this contest is the great number of judges that

Software Project Management hw1

I just want to say something about my java project that I did last year. Our task is to finish a linking game. It is a game that you should link all the same picture with specific rules. It is such an interesting game but creating the game can not be

Top 6 Refactoring Patterns to Help You Score 80% in Code Quality

Top 6 Refactoring Patterns to Help You Score 80% in Code Quality Posted by Ajitesh Kumar / In Code Review, Software Quality / January 31, 2014 Have done several code reviews in past and found following top 5 code smells common across most of these co

Jabber Software:Jabber-NET、agsXMPP与Wilefire[转]

本篇介绍两个使用.NET技术,确切的说是使用C#写的Jabber Code Libraries – Jabber.NET.agsXMPP,以及一个Java写的跨平台Jabber Server – Wilefire. 前言: 即将完成Jabber Protocal(XMPP) : Core的翻译,在接下来的学习中将结合使用一个Jabber代码库和一个Jabber服务器,做些XMPP实现的分析与Practice. Jabber-NET Jabber- NET是一个使用.NET技术连接到Jabber服

CS 350 Software Design / SE 310 Software Architecture

CS 350 Software Design / SE 310 Software Architecture I Homework Assignment - Part 1 NOTE: this is a very demanding project and it will require a lot of effort and a substantial amount of time. For part 1 of this project, spending a just few hours or

software source

whati is software source? software source is a houselive.it provide any softwares from sources.list. or it can be recognized as a address of server.we can assign this adress of server. so how to alter the address of server? so we have methods ,the on

View Composer Agent initialization error (16): Failed to activate software license (1026556)

1.       桌面发布过程中偶尔有些桌面池中的桌面提示无法访问代理,查看报错信息如下:View Composer Agent initialization error (16):Failed to activate software license (1026556). KB地址:https://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&externalId=1026556 主要意思是Windows 7系统激活的

微软职位内部推荐-Software Engineer II

微软近期Open的职位: Job Title: Software Engineer II Location: Beijing, China Document Understanding and Task (DUT) team in STCA focuses on semantic understanding and answer recommendation platform and features for Bing, Cortana and Office. &nbsp Responsibil