結果

問題 No.2424 Josouzai
ユーザー Fullmoon8507Fullmoon8507
提出日時 2023-10-30 20:06:58
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 395 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 5,280 KB
実行使用メモリ 71,616 KB
最終ジャッジ日時 2023-10-30 20:07:14
合計ジャッジ時間 14,048 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
37,476 KB
testcase_01 AC 66 ms
37,476 KB
testcase_02 AC 66 ms
37,476 KB
testcase_03 AC 65 ms
37,476 KB
testcase_04 AC 177 ms
49,796 KB
testcase_05 AC 395 ms
69,100 KB
testcase_06 AC 386 ms
69,336 KB
testcase_07 AC 383 ms
69,336 KB
testcase_08 AC 394 ms
69,100 KB
testcase_09 AC 66 ms
37,504 KB
testcase_10 AC 117 ms
50,032 KB
testcase_11 AC 201 ms
66,872 KB
testcase_12 AC 175 ms
62,416 KB
testcase_13 AC 169 ms
49,468 KB
testcase_14 AC 243 ms
57,948 KB
testcase_15 AC 96 ms
44,524 KB
testcase_16 AC 359 ms
65,596 KB
testcase_17 AC 143 ms
48,968 KB
testcase_18 AC 156 ms
50,856 KB
testcase_19 AC 216 ms
56,492 KB
testcase_20 AC 352 ms
68,960 KB
testcase_21 AC 284 ms
61,832 KB
testcase_22 AC 165 ms
49,332 KB
testcase_23 AC 186 ms
52,528 KB
testcase_24 AC 122 ms
46,956 KB
testcase_25 AC 368 ms
70,956 KB
testcase_26 AC 285 ms
61,856 KB
testcase_27 AC 383 ms
71,616 KB
testcase_28 AC 328 ms
67,120 KB
testcase_29 AC 303 ms
62,616 KB
testcase_30 AC 125 ms
47,536 KB
testcase_31 AC 208 ms
56,452 KB
testcase_32 AC 374 ms
71,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let lines = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
let buf = lines[0].split(" ");
let placeNum = parseInt(buf[0]);
let jyosoluzaiNum = parseInt(buf[1]);

let placeList = [];
for(let place of lines[1].split(" ")){
    placeList.push(parseInt(place));
}

placeList.sort((a,b) => a-b);

let count = 0;
for(let place of placeList){
    if(place <= jyosoluzaiNum){
        count++;
        jyosoluzaiNum -= place;
    } else {
        break;
    }
}

console.log(count + " " + jyosoluzaiNum);
0