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
#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 = ;
int mx = ,mi = ;
for(i = ;i<n;i++)
{
int a;
scanf("%d",&a);
mi = min(mi,a);
mx = max(mx,a);
sum += a;
}
cout<<(sum-mx-mi)/(n-)<<endl;
}
return ;
}

hdu2309ICPC Score Totalizer Software的更多相关文章

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

    Problem Description The International Clown and Pierrot Competition (ICPC), is one of the most disti ...

  2. OJ题解记录计划

    容错声明: ①题目选自https://acm.ecnu.edu.cn/,不再检查题目删改情况 ②所有代码仅代表个人AC提交,不保证解法无误 E0001  A+B Problem First AC: 2 ...

  3. 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 lin ...

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

    本篇介绍两个使用.NET技术,确切的说是使用C#写的Jabber Code Libraries – Jabber.NET.agsXMPP,以及一个Java写的跨平台Jabber Server – Wi ...

  5. Software Engineering-HW3 264&249

    title: Software Engineering-HW3 date: 2017-10-05 10:04:08 tags: HW --- 小组成员 264 李世钰 249 王成科 项目地址 htt ...

  6. SENG201 (Software Engineering I) Project

    SENG201 (Software Engineering I) ProjectSpace ExplorerFor project admin queries:For project help, hi ...

  7. How can I perform the likelihood ratio, Wald, and Lagrange multiplier (score) test in Stata?

      http://www.ats.ucla.edu/stat/stata/faq/nested_tests.htm The likelihood ratio (lr) test, Wald test, ...

  8. Software Engineer’s path to the best annual performance review

    http://michaelscodingspot.com/2017/06/04/software-engineers-path-best-annual-performance-review/ How ...

  9. Software Engineering at Google

    Google的Fergus Henderson在Software Engineering at Google中介绍了Google的软件工程实践. 软件开发 源码仓库 单一源代码仓库,除了核心配置和安全 ...

随机推荐

  1. Dapper simplecrud的使用

    为了方便Dapper操作可以使用Dapper的相关扩展dapper simplecrud. 1.首先点击管理NuGet

  2. 网络编程之TCP

    知识补充:源IP地址和目的IP地址以及源端口号和目的端口号的组合称为套接字.其用于标识客户端请求的服务器和服务. TCP编程的实现步骤:服务器端:1.通过ServletSocket创建绑定到指定客户端 ...

  3. linux ar 命令的使用说明那个和例子[转]

    用途说明 创建静态库.a文件.用C/C++开发程序时经常用到,但我很少单独在命令行中使用ar命令,一般写在makefile中,有时也会在shell脚 本中用到.关于Linux下的库文件.静态库.动态库 ...

  4. 高可用集群(HA)之DRBD原理和基础配置

    目录 1.工作原理图 2.用户空间工具 3.工作模式 4.实现主备故障自动切换 5.所需软件 6.配置文件 7.详细配置     1.配置通用属性信息     2.定义一个资源     3.初始化资源 ...

  5. 深入 char * ,char ** ,char a[ ] ,char *a[] 内核

    本文来自CSDN博客:daiyutage的文章 来源网页地址:http://blog.csdn.net/daiyutage/article/details/8604720 本人觉得这是一编很有价值的文 ...

  6. C#代码实现,确保windows程序只有一个实例(instance)

    static class Program { /// <summary> /// 应用程序的主入口点. /// </summary> [STAThread] static vo ...

  7. phalcon

    phalcon 代码内在sql 内用Ad去取数据库内的ad表. osx上没问题, centos报找不到表. 应该是centos上mysql区分大小写,可改写mysql的配置.

  8. HTML条件注释用法诠释

    HTML条件注释用法诠释 注释内容以样式为例,如下: 1.支持所有IE浏览器 <!--[if IE]> <link rel="stylesheet" href=& ...

  9. Ext.getCmp()的简单使用

    Ext.getCmp(Ext组件ID),根据Ext组件的ID选择EXT组件. 例如:点击Panel->toolbar上的button改变Panel的标题 Ext.onReady(function ...

  10. ubuntu下编译源码级QT

    注意必须好好看官方文档: http://qt-project.org/doc/qt-5/linux.html 包括编译Qt库依赖的包等等. 编译过程中发现以下错误: All the OpenGL fu ...