結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2017-06-23 13:12:30 |
言語 | JavaScript (node v23.5.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 541 bytes |
コンパイル時間 | 31 ms |
コンパイル使用メモリ | 6,692 KB |
実行使用メモリ | 43,136 KB |
最終ジャッジ日時 | 2024-10-13 00:13:19 |
合計ジャッジ時間 | 3,364 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
function Main(input) { var line = input.split("\n"); var L = +line[0]; var N = +line[1]; var W = line[2].split(" ").map(Number); rapt(L,N,W); } function rapt(L,N,W) { var widthSum = 0; var countBox = 0; W.sort(function (a, b) { if (a < b) return -1; if (a > b) return 1; return 0; }); for (var i = 0; widthSum < L; i++) { widthSum += W[i]; countBox += 1; } console.log(countBox - 1); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));