結果

問題 No.176 2種類の切手
ユーザー ぴろず
提出日時 2015-04-02 23:55:06
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 2,267 ms
コンパイル使用メモリ 73,672 KB
実行使用メモリ 56,056 KB
最終ジャッジ日時 2024-10-08 01:47:41
合計ジャッジ時間 8,759 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

package no176;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		int max = Math.min(a-1, (t+b-1)/b);
		long ans = Long.MAX_VALUE;
		for(int y=0;y<max;y++) {
			long x = (t - (long)b * y + a - 1) / a;
			ans = Math.min(a * x + b * y, ans);
		}
		System.out.println(ans);
	}

}
0