QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22319. Statistics

Statistics

The cows have enrolled in elementary statistics and are having a tough time with their homework. Please help them.

Given a set of $N$ $(1 \le N \le 500)$ numbers, $X_{i}$ $(-5,000 \le X_{i} \le 5000)$, calculate two statistics:

     * The mean (sum of the numbers divided by N)
     * The median (if N is odd, the middle number when the N numbers
       are sorted; if N is even, the mean of the two middle numbers
       when the N numbers are sorted)

Your answer will be considered correct if it is within 0.002 of the official answer.

Input

  • Line 1: A single integer: $N$

  • Lines $2,\ldots,N+1$: Line $i+1$ contains a single integer: $X_{i}$

Output

  • Line 1: The mean of the input set

  • Line 2: The median of the input set

Examples

Input 1

5
12
4
6
8
2

Output 1

6.400000
6.000000

$(12+4+6+8+2)/5=6.4$ Middle number of the set {2, 4, 6, 8, 12} is 6

Problem credits: Traditional, 2008

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.