結果

問題 No.275 中央値を求めよ
ユーザー turner18_jp
提出日時 2017-09-28 21:21:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 215 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-11-15 18:22:01
合計ジャッジ時間 2,632 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 28 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n = int(input())
l = list(map(int, input().split()))
l.sort()

if not len(l) % 2 == 0:
    print(l[math.floor(len(l) / 2)])
else:
    pivot = int(len(l) / 2)
    print(int((l[pivot] + l[pivot - 1]) / 2))
0