結果

問題 No.275 中央値を求めよ
ユーザー GrayCoder
提出日時 2017-06-24 11:42:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 252 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-25 00:33:21
合計ジャッジ時間 2,513 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = sorted(A)
    l = len(a)
    if l & 1:
        ans = a[l // 2]
    else:
        s = l // 2 - 1
        e = s * -1
        ans = sum(a[s:e]) / 2

    print(ans)

main()
0