結果

問題 No.275 中央値を求めよ
ユーザー swyroakswyroak
提出日時 2021-08-04 00:12:48
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 82 ms / 1,000 ms
コード長 549 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 5,152 KB
実行使用メモリ 44,148 KB
最終ジャッジ日時 2023-10-14 21:12:04
合計ジャッジ時間 5,257 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
42,264 KB
testcase_01 AC 80 ms
42,192 KB
testcase_02 AC 79 ms
42,320 KB
testcase_03 AC 80 ms
41,928 KB
testcase_04 AC 80 ms
42,048 KB
testcase_05 AC 82 ms
42,164 KB
testcase_06 AC 79 ms
41,976 KB
testcase_07 AC 80 ms
42,060 KB
testcase_08 AC 80 ms
41,984 KB
testcase_09 AC 79 ms
42,020 KB
testcase_10 AC 80 ms
42,272 KB
testcase_11 AC 79 ms
41,776 KB
testcase_12 AC 78 ms
41,972 KB
testcase_13 AC 79 ms
42,004 KB
testcase_14 AC 79 ms
41,960 KB
testcase_15 AC 82 ms
44,148 KB
testcase_16 AC 79 ms
42,028 KB
testcase_17 AC 80 ms
42,032 KB
testcase_18 AC 79 ms
42,036 KB
testcase_19 AC 79 ms
41,852 KB
testcase_20 AC 81 ms
41,792 KB
testcase_21 AC 81 ms
42,308 KB
testcase_22 AC 80 ms
42,060 KB
testcase_23 AC 79 ms
41,908 KB
testcase_24 AC 81 ms
42,044 KB
testcase_25 AC 81 ms
42,344 KB
testcase_26 AC 80 ms
41,988 KB
testcase_27 AC 80 ms
42,020 KB
testcase_28 AC 80 ms
41,908 KB
testcase_29 AC 81 ms
41,904 KB
testcase_30 AC 82 ms
41,940 KB
testcase_31 AC 81 ms
42,192 KB
testcase_32 AC 82 ms
42,300 KB
testcase_33 AC 81 ms
42,300 KB
testcase_34 AC 79 ms
41,884 KB
testcase_35 AC 81 ms
41,916 KB
testcase_36 AC 82 ms
41,784 KB
testcase_37 AC 81 ms
43,944 KB
testcase_38 AC 79 ms
41,780 KB
testcase_39 AC 79 ms
41,788 KB
testcase_40 AC 79 ms
42,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"use strict";
function Main(input) {
    const num = Number(input.split("\n")[0]);
    const preseries = input.split("\n")[1].split(" ").map(i => Number(i));
    const series = preseries.sort((a, b) => a - b);
    if (num % 2 === 1) {
        console.log(series[Math.ceil(num / 2) - 1]);
    }
    else {
        console.log((series[(num / 2) - 1] + series[(num / 2)]) / 2);
    }
}
//テストの入力を受け取る
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//Main("6\n4 8 2 4 6 5");
//# sourceMappingURL=index.js.map
0