結果

問題 No.5 数字のブロック
ユーザー mlpj56d
提出日時 2017-06-23 12:18:13
言語 JavaScript
(node v23.5.0)
結果
RE  
実行時間 -
コード長 521 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 6,696 KB
実行使用メモリ 42,224 KB
最終ジャッジ日時 2024-10-13 00:12:03
合計ジャッジ時間 3,185 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
        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