結果

問題 No.5 数字のブロック
ユーザー swyroakswyroak
提出日時 2021-08-08 18:23:00
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 139 ms / 5,000 ms
コード長 598 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 5,152 KB
実行使用メモリ 40,408 KB
最終ジャッジ日時 2023-10-19 18:46:54
合計ジャッジ時間 5,526 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
37,496 KB
testcase_01 AC 67 ms
37,496 KB
testcase_02 AC 67 ms
37,496 KB
testcase_03 AC 139 ms
40,408 KB
testcase_04 AC 75 ms
38,812 KB
testcase_05 AC 78 ms
39,096 KB
testcase_06 AC 74 ms
38,928 KB
testcase_07 AC 74 ms
38,884 KB
testcase_08 AC 75 ms
39,096 KB
testcase_09 AC 71 ms
38,748 KB
testcase_10 AC 79 ms
39,144 KB
testcase_11 AC 73 ms
38,864 KB
testcase_12 AC 76 ms
39,008 KB
testcase_13 AC 78 ms
39,092 KB
testcase_14 AC 68 ms
37,552 KB
testcase_15 AC 68 ms
37,556 KB
testcase_16 AC 78 ms
39,116 KB
testcase_17 AC 81 ms
39,360 KB
testcase_18 AC 80 ms
39,176 KB
testcase_19 AC 82 ms
39,736 KB
testcase_20 AC 67 ms
37,552 KB
testcase_21 AC 67 ms
37,552 KB
testcase_22 AC 67 ms
37,552 KB
testcase_23 AC 67 ms
37,552 KB
testcase_24 AC 68 ms
37,572 KB
testcase_25 AC 68 ms
37,588 KB
testcase_26 AC 67 ms
37,552 KB
testcase_27 AC 67 ms
37,552 KB
testcase_28 AC 67 ms
37,552 KB
testcase_29 AC 73 ms
38,824 KB
testcase_30 AC 71 ms
38,772 KB
testcase_31 AC 67 ms
37,552 KB
testcase_32 AC 68 ms
37,552 KB
testcase_33 AC 67 ms
37,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"use strict";
function Main(input) {
    let BoxLength;
    let Blockqty;
    let Blocks;
    let j, k;
    j = 0;
    k = -1;
    BoxLength = Number(input.split("\n")[0]);
    Blockqty = Number(input.split("\n")[1]);
    Blocks = input.split("\n")[2].split(" ").map((i) => Number(i)).sort((a, b) => a - b);
    do {
        ++k;
        j += Blocks[k];
    } while (j <= BoxLength && k != Blockqty);
    console.log(k);
}
//テストの入力を受け取る
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//Main("557\n3\n171 272 52");
//# sourceMappingURL=index.js.map
0