結果

問題 No.143 豆
ユーザー swyroakswyroak
提出日時 2021-08-04 22:49:15
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 75 ms / 1,000 ms
コード長 571 bytes
コンパイル時間 45 ms
コンパイル使用メモリ 5,336 KB
実行使用メモリ 41,880 KB
最終ジャッジ日時 2023-10-14 21:26:10
合計ジャッジ時間 3,395 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
41,596 KB
testcase_01 AC 75 ms
41,776 KB
testcase_02 AC 75 ms
41,880 KB
testcase_03 AC 75 ms
41,600 KB
testcase_04 AC 74 ms
41,708 KB
testcase_05 AC 73 ms
41,808 KB
testcase_06 AC 73 ms
41,596 KB
testcase_07 AC 73 ms
41,728 KB
testcase_08 AC 75 ms
41,848 KB
testcase_09 AC 73 ms
41,608 KB
testcase_10 AC 73 ms
41,780 KB
testcase_11 AC 72 ms
41,772 KB
testcase_12 AC 73 ms
41,740 KB
testcase_13 AC 74 ms
41,656 KB
testcase_14 AC 74 ms
41,828 KB
testcase_15 AC 73 ms
41,644 KB
testcase_16 AC 73 ms
41,588 KB
権限があれば一括ダウンロードができます

ソースコード

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