OTHS Coding Competition 1 (Mock CCC) J2 - Wand Selection

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 512M

Authors:
Problem types

Megumin loves creating explosions and wishes to buy a new wand. When buying a new wand, she is instructed to find the average volume of her explosions, rounded down to the nearest cubic meter, so they can pick the best one. As her consultant, she asks you to do it for her. Unfortunately, she did not record the explosions herself, so she instead provides you with N property damage reports that contain the volume v_i of that explosion in cubic meters.

However, one of the explosions was created together with the Crimson Magic clan. Since the Crimson Magic clan is so strong, the explosion created with them is always the largest one. She asks that you don't include this explosion in the average.

Constraints

2 \leq N \leq 100

1 \leq v_i \leq 100

Input Specification

The first line of input is N, the number of explosions.

The next N lines contain one positive integer, v_i, the size of each explosion.

Output Specification

Output one integer, the average volume of her explosions, excluding the largest one and rounded down to the nearest integer.

Sample Input 1

5
3
4
1
7
2

Sample Output 1

2

Explanation for Sample Output 1

We exclude the largest explosion, 7, as it was not created by Megumin alone.

The average of the 4 other numbers is (3+4+1+2)/4 = 2.5, which rounds down to 2.

Sample Input 2

2
10
10

Sample Output 2

10

Comments

There are no comments at the moment.