Hdoj (HDU) 2309 ICPC score Totalizer software (averaging)

Source: Internet
Author: User

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 are the great number of judges that sometimes counts up to one hundred. The number of judges differ from one contestant to another, because judges with any relationship whatsoever with a SPE Cific contestant is temporarily excluded for scoring his/her performance.

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

You is asked to write a program this computes the scores of performances, given the scores of all the judges The event to is suited for a TV program.

Input
The input consists of a number of datasets, each corresponding to a contestant ' s performance. There is no more than-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 have an integral score s (0≤s≤1000) marked by a judge. No other characters except for digits to express these numbers is in the input. Judges ' names is 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 is 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

The scores are all integers! The average score is also an integer!
Judges score, remove a top score, remove a minimum score, ask for the rest of the average score!
No rounding. You can just take the decimal place.

Import Java.util.Scanner; Public classmain{ Public Static void Main(string[] args) {Scanner SC =NewScanner (System.inch); while(Sc.hasnext ()) {intN=sc.nextint ();if(n<=0){return; }intsum =0;intmin = Sc.nextint ();intMax=min; Sum=max;intb for(intI=1; i<n;i++) {b = Sc.nextint ();if(B>max)                {max=b; }if(b<min)                {min=b;            } sum+=b;            } Sum=sum-min-max; System. out. println (int) (sum/(n2))); }    }}

Hdoj (HDU) 2309 ICPC score Totalizer software (averaging)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.