結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-09 02:21:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 362 bytes |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-14 20:53:22 |
| 合計ジャッジ時間 | 2,536 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 38 |
ソースコード
n = int(input())
#入力値を昇順ソートする
numList = sorted(list(map(int, input().split())))
length = len(numList)
if length % 2 == 0:
#偶数の場合は、中央に近い2値の平均
mid = (numList[floor(length / 2)] - numList[ceil(length / 2)]) / 2
else:
#配列の中央の値を取得
mid = (numList[ceil(length / 2)])
print(mid)