結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2015-12-24 15:25:29 |
言語 | JavaScript (node v23.5.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 463 bytes |
コンパイル時間 | 122 ms |
コンパイル使用メモリ | 5,120 KB |
実行使用メモリ | 43,136 KB |
最終ジャッジ日時 | 2024-10-12 23:37:00 |
合計ジャッジ時間 | 3,309 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 24 |
ソースコード
function compareNumbers(a, b){ return a-b; } function Main(input) { var data = input.split("\n") var L = data[0]; var N = data[1]; var W = data[2].split(" "); for(var i=0; i<W.length; ++i){ W[i] = parseInt(W[i]); } W.sort(compareNumbers); var total = 0; while(total<L && i<N){ total += W[i]; ++i; } console.log(i); } // Don't edit this line! Main(require("fs").readFileSync("/dev/stdin", "utf8"));