結果

問題 No.143 豆
ユーザー swyroak
提出日時 2021-08-04 22:49:15
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 64 ms / 1,000 ms
コード長 571 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 5,632 KB
実行使用メモリ 39,040 KB
最終ジャッジ日時 2024-09-16 15:11:32
合計ジャッジ時間 2,262 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

"use strict";
function Main(input) {
    let net;
    let qty;
    let fam;
    [net, qty, fam] = input.split("\n")[0].split(" ").map(i => Number(i));
    const ages = input.split("\n")[1].split(" ").map(i => Number(i)).reduce((accum, current) => accum + current);
    const beans = net * qty;
    if (beans < ages) {
        console.log(-1);
    }
    else {
        console.log(beans - ages);
    }
}
//テストの入力を受け取る
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//Main("5 5 3\n3 10 5");
//# sourceMappingURL=index.js.map
0