DMOPC '17 Contest 3 P1 - An Early Christmas Present

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Your teacher has decided to give you an early Christmas present: they will drop one of your N test marks! Being a very academically focused student, you naturally want your resulting average of the remaining marks to be as high as possible. As a student at the prestigious DMCI: Modern Computing Institute, your marks do not simply range from 0 to 100, but have a much larger range. Which mark should you drop to maximize your average?

Constraints

Subtask 1 [10%]

2N1000
106Ai106

Subtask 2 [90%]

2N105
109Ai109

Input Specification

The first line of input will contain a single integer: N.
The next line will contain N space-separated integers: A1,A2,,AN, the ith of which corresponds to your ith mark.

Output Specification

A single integer, the mark that when removed, maximizes the average of the remaining N1 marks.

Sample Input 1

Copy
5
98 -20 96 100 96

Sample Output 1

Copy
-20

Sample Input 2

Copy
4
3 3 1 1

Sample Output 2

Copy
1

Comments


  • 1
    HarryG1233  commented 68 days ago

    Robert_Barnes, Very Skibidi


  • 2
    Robert_Barnes  commented 68 days ago

    felixhang25 very funny my friend


  • 8
    felixzhang25  commented on April 15, 2018, 4:38 p.m. edited

    Sample Input 1

    5

    98 -20 96 100 96

    lOL hOW diD yOU GEt -20 oN a tESt