結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-18 23:13:37 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
AC
|
| 実行時間 | 168 ms / 5,000 ms |
| コード長 | 370 bytes |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 6,944 KB |
| 実行使用メモリ | 45,048 KB |
| 最終ジャッジ日時 | 2024-07-18 23:13:43 |
| 合計ジャッジ時間 | 5,584 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
function Main(input) {
input = input.split("\n");
const l = parseInt(input[0]);
const w = input[2].split(" ").map(s=>parseInt(s));
w.sort((x,y)=>x-y);
let res = 0;
let cnt = 0;
for (let x of w) {
res += x;
if (res > l) break;
cnt++;
}
console.log(cnt);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));