408630: GYM103241 E Calculating Costs

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Calculating Coststime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Cameron is a cashier for a store and at the end of the day, Cameron wrote down the money he got from each customer throughout the day. His manager wants the mean, median, and mode of the list of money from each customer. The manager wants all numbers to be rounded down to the nearest integer, and if there are multiple modes, then the manager wants the largest mode. If the number of customers that day was even, then the manager wants the median to be the average of the two middle numbers, rounded down.

Input

The first line has an integer $$$1 < N \leq 1000$$$, representing the number of customers throughout the day.

The second line has $$$N$$$ space-separated integers, $$$1 \leq K \leq 1000$$$, where $$$K$$$ represents each space-separated integer.

Output

Print the mean, median, and mode of the list of numbers in that order, each on a separate line, rounding down to the nearest integer.

ExampleInput
5
3 7 5 18 7
Output
8
7
7
Note

Problem idea: Spark

Problem preparation: Spark

Occurances: Novice 5

加入题单

上一题 下一题 算法标签: