結果

問題 No.1517 Party Location
ユーザー test
提出日時 2022-11-21 13:44:12
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 6,812 KB
実行使用メモリ 38,912 KB
最終ジャッジ日時 2024-09-22 06:41:42
合計ジャッジ時間 2,133 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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