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. .Net平台下ActiveMQ入门实例(转)

    1.ActiveMQ简介 先分析这么一个场景:当我们在网站上购物时,必须经过,下订单.发票创建.付款处理.订单履行.航运等.但是,当用户下单后,立即跳转到"感谢那您的订单" 页面. ...

  2. 反引号backtick中输入多个命令

    如果在反引号backtick中输入多个命令会怎样?比如有如下脚本: #!/bin/bash var=`date;who` echo $var 运行该脚本,会发现输出的是命令date和who的集合,只是 ...

  3. js数组小结

    1.js数组使用sort()排序 var a = ["1","12","3","4","0"]; d ...

  4. WordPress插件制作教程(一): 如何创建一个插件

    上一篇还是按照之前的教程流程,写了一篇WordPress插件制作教程概述,从这一篇开始就为大家具体讲解WordPress插件制作的内容.这一篇主要说一下插件的创建方法. 相信大家都知道插件的安装文件在 ...

  5. Palindrome(POJ 1159 DP)

      Palindrome Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 58168   Accepted: 20180 De ...

  6. IClone地形编辑器结合T4M插件在Unity3D使用

    通过IClone编辑器打造的地形,经过T4M插件的转化后,资源占用极少,比在Unity中自己刷出来的地形再通过T4M转化的要小的的多多了,非常适合用在手机上. IClone地形编辑器下载地址: 如果对 ...

  7. BZOJ NOI十连测 第一测 T2

    思路:看到这题,就感觉是一道很熟悉的题目: http://www.cnblogs.com/qzqzgfy/p/5535821.html 只不过这题的K最多可以到N,而且边权不再只是1,考试的时候yy了 ...

  8. QSizePolicy可均匀调整控件的大小,还可设置比例,非常完美(每个QWidget都有这个功能)

    http://blog.csdn.net/liang19890820/article/details/51986284 它是QWidget的固有属性: http://doc.qt.io/qt-4.8/ ...

  9. jQuery插件之validate

    一.jQuery.validate.js插件用于对表单输入进行验证,其使用配置非常简单.支持多事件触发,自带多种验证规则,还支持自定义验证规则. 1.配置方法. 先导入jQuery库,然后导入Vali ...

  10. mysql logstash 配置

    [elk@dr-mysql01 mysql]$ cat logstash_mysql.conf input { file { type => "zj_mysql" path ...