結果

問題 No.275 中央値を求めよ
ユーザー yun_appyun_app
提出日時 2016-05-11 12:28:38
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 79 ms / 1,000 ms
コード長 485 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 43,648 KB
最終ジャッジ日時 2024-04-21 01:22:11
合計ジャッジ時間 4,129 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
39,808 KB
testcase_01 AC 75 ms
39,936 KB
testcase_02 AC 72 ms
40,064 KB
testcase_03 AC 69 ms
39,808 KB
testcase_04 AC 69 ms
39,808 KB
testcase_05 AC 71 ms
39,936 KB
testcase_06 AC 70 ms
39,808 KB
testcase_07 AC 79 ms
43,136 KB
testcase_08 AC 75 ms
39,936 KB
testcase_09 AC 73 ms
39,936 KB
testcase_10 AC 71 ms
40,192 KB
testcase_11 AC 69 ms
39,808 KB
testcase_12 AC 70 ms
39,808 KB
testcase_13 AC 73 ms
39,936 KB
testcase_14 AC 69 ms
39,808 KB
testcase_15 AC 73 ms
43,520 KB
testcase_16 AC 72 ms
40,064 KB
testcase_17 AC 73 ms
39,936 KB
testcase_18 AC 79 ms
40,064 KB
testcase_19 AC 74 ms
43,520 KB
testcase_20 AC 72 ms
43,136 KB
testcase_21 AC 73 ms
43,648 KB
testcase_22 AC 73 ms
43,264 KB
testcase_23 AC 74 ms
43,264 KB
testcase_24 AC 73 ms
40,064 KB
testcase_25 AC 71 ms
43,520 KB
testcase_26 AC 73 ms
43,264 KB
testcase_27 AC 73 ms
43,264 KB
testcase_28 AC 76 ms
39,808 KB
testcase_29 AC 71 ms
43,392 KB
testcase_30 AC 71 ms
39,808 KB
testcase_31 AC 73 ms
43,136 KB
testcase_32 AC 68 ms
39,936 KB
testcase_33 AC 72 ms
43,136 KB
testcase_34 AC 70 ms
40,064 KB
testcase_35 AC 73 ms
43,136 KB
testcase_36 AC 72 ms
43,264 KB
testcase_37 AC 69 ms
40,192 KB
testcase_38 AC 68 ms
39,680 KB
testcase_39 AC 69 ms
40,192 KB
testcase_40 AC 74 ms
43,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
    main(chunk.trim());
});
function main(chunk){
    // your code goes here
    var lines = chunk.split("\n");
    var n = Number(lines[0]);
    var nums = lines[1].split(" ");
    var arr = [];
    for(var i in nums){
        arr.push(Number(nums[i]));
    }
    arr.sort(function(a,b){return a-b;});
    
    console.log((arr[Math.floor((n-1)/2)] + arr[Math.ceil((n-1)/2)])/2);
}
0