QOJ.ac

QOJ

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

#22319. 統計

Statistics

牛報名初等統計課,作業很難。請幫助她們。

給定 $N$ $(1 \le $N$ \le 500)$ 個數 $X_{i}$ $(-5,000 \le X_{i} \le 5000)$,計算兩個統計量:

  • 平均數(數值總和除以 $N$)。
  • 中位數($N$ 奇數時為排序後中間數;$N$ 偶數時為排序後中間兩數的平均數)。

答案與標準答案差不超過0.002即正確。

輸入格式

  • 第1行:一整數 $N$。
  • 第 $2,\ldots,$N$+1$ 行:第 $i+1$ 行含一整數 $X_{i}$。

輸出格式

  • 第1行:輸入集合平均數。
  • 第2行:輸入集合中位數。

範例

輸入格式 1

5
12
4
6
8
2

輸出格式 1

6.400000
6.000000

說明

$(12+4+6+8+2)/5=6.4$。集合 {2, 4, 6, 8, 12} 中間數為6。

題目作者: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.