結果

問題 No.275 中央値を求めよ
ユーザー wata_pythonwata_python
提出日時 2019-08-14 20:05:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 275 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 11,836 KB
実行使用メモリ 10,276 KB
最終ジャッジ日時 2023-10-19 18:13:30
合計ジャッジ時間 3,564 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 RE -
testcase_04 AC 29 ms
10,156 KB
testcase_05 AC 28 ms
10,156 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 29 ms
10,156 KB
testcase_13 RE -
testcase_14 AC 28 ms
10,156 KB
testcase_15 WA -
testcase_16 RE -
testcase_17 WA -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 WA -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 WA -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = input()

S = list(A)         # リストに格納
while " " in S:     # " "の要素削除
    S.remove(" ")

S2 = sorted(S)

if N % 2 == 1:
    i = N/2 + 1
    ans = int(S2[i])
else:
    i = int(N/2)
    ans = (int(S2[i]) + int(S2[i-1])) / 2

print(ans)
0