結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2019-04-30 08:30:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 35 ms / 1,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 653 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-26 17:04:30 |
合計ジャッジ時間 | 3,040 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
N = int(input()) A = [int(x) for x in input().split()] A.sort() half_n = N // 2 center_value = -1 if N % 2: center_value = A[half_n] else: c1,c2 = A[half_n - 1:half_n + 1] center_value = (c1 + c2) / 2 if center_value % 1: center_value = "{:.1f}".format(center_value) else: center_value = "{:.0f}".format(center_value) print(center_value)