結果

問題 No.5 数字のブロック
ユーザー mlpj56d
提出日時 2017-06-23 12:09:32
言語 JavaScript
(node v23.5.0)
結果
RE  
実行時間 -
コード長 512 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 42,104 KB
最終ジャッジ日時 2024-10-13 00:11:55
合計ジャッジ時間 2,954 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

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, M);
}

function rapt(L, M, N) {
    var widthSum = 0;
    var countBox = 0;

    W.sort(function (a, b) {
        if (a < b) {
            return -1;
        }
    });

    for (var i = 0; widthSum < L; i++) {
        widthSum += W[i];
        countBox += 1;
    }

    console.log(countBox);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0