結果

問題 No.275 中央値を求めよ
ユーザー norioc
提出日時 2022-11-28 19:25:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 1,000 ms
コード長 178 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 53,960 KB
最終ジャッジ日時 2024-10-05 19:16:18
合計ジャッジ時間 2,593 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

A.sort()
if len(A) % 2 == 0:
    p = N // 2 - 1
    m = sum(A[p:p+2]) / 2
    print(m)
else:
    m = A[N // 2]
    print(m)
0