結果

問題 No.1517 Party Location
ユーザー ks2mks2m
提出日時 2021-05-28 20:49:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 71,520 KB
実行使用メモリ 55,828 KB
最終ジャッジ日時 2023-09-02 04:09:58
合計ジャッジ時間 4,722 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,384 KB
testcase_01 AC 123 ms
55,480 KB
testcase_02 AC 132 ms
55,388 KB
testcase_03 AC 136 ms
55,580 KB
testcase_04 AC 137 ms
55,828 KB
testcase_05 AC 124 ms
55,636 KB
testcase_06 AC 123 ms
55,260 KB
testcase_07 AC 123 ms
55,748 KB
testcase_08 AC 125 ms
55,812 KB
testcase_09 AC 125 ms
55,716 KB
testcase_10 AC 127 ms
55,544 KB
testcase_11 AC 125 ms
55,456 KB
testcase_12 AC 124 ms
55,576 KB
testcase_13 AC 124 ms
55,760 KB
testcase_14 AC 125 ms
55,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		int ans = Integer.MAX_VALUE;
		for (int x = 0; x <= d; x++) {
			int c = x * a + (d - x) * b;
			ans = Math.min(ans, c);
		}
		System.out.println(ans);
	}
}
0