結果

問題 No.1517 Party Location
ユーザー testtest
提出日時 2022-11-21 13:44:12
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 5,152 KB
実行使用メモリ 41,540 KB
最終ジャッジ日時 2023-10-22 05:23:26
合計ジャッジ時間 2,540 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
37,532 KB
testcase_01 AC 71 ms
37,532 KB
testcase_02 AC 145 ms
41,540 KB
testcase_03 AC 68 ms
37,580 KB
testcase_04 AC 72 ms
37,580 KB
testcase_05 AC 72 ms
37,580 KB
testcase_06 AC 69 ms
37,580 KB
testcase_07 AC 72 ms
37,580 KB
testcase_08 AC 71 ms
37,580 KB
testcase_09 AC 76 ms
41,432 KB
testcase_10 AC 76 ms
41,432 KB
testcase_11 AC 75 ms
37,580 KB
testcase_12 AC 69 ms
37,580 KB
testcase_13 AC 72 ms
41,432 KB
testcase_14 AC 75 ms
41,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {

    let src = input.split("\n");
    let d = parseInt(src[0]);
    let arr = src[1].split(" ");
    let a = parseInt(arr[0]);
    let b = parseInt(arr[1]);
    let ans = 100000000;

    for (let x = 0; x <= d; x++) {
        ans = Math.min(ans, x * a + (d - x) * b);
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0