結果

問題 No.1517 Party Location
コンテスト
ユーザー ks2m
提出日時 2021-05-28 20:49:29
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 391 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,826 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 46,916 KB
最終ジャッジ日時 2026-03-04 12:24:13
合計ジャッジ時間 3,030 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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