結果

問題 No.176 2種類の切手
ユーザー ぴろずぴろず
提出日時 2015-04-02 23:55:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 2,363 ms
コンパイル使用メモリ 74,100 KB
実行使用メモリ 54,412 KB
最終ジャッジ日時 2024-04-16 21:30:01
合計ジャッジ時間 7,853 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,468 KB
testcase_01 AC 134 ms
41,588 KB
testcase_02 AC 133 ms
41,304 KB
testcase_03 AC 136 ms
41,424 KB
testcase_04 AC 131 ms
41,300 KB
testcase_05 AC 134 ms
41,444 KB
testcase_06 AC 134 ms
41,648 KB
testcase_07 AC 133 ms
41,688 KB
testcase_08 AC 135 ms
41,636 KB
testcase_09 AC 132 ms
41,476 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 132 ms
40,920 KB
testcase_13 AC 132 ms
41,392 KB
testcase_14 AC 133 ms
41,168 KB
testcase_15 AC 135 ms
41,432 KB
testcase_16 AC 136 ms
41,524 KB
testcase_17 WA -
testcase_18 AC 133 ms
41,532 KB
testcase_19 AC 134 ms
41,148 KB
testcase_20 AC 134 ms
41,392 KB
testcase_21 AC 132 ms
41,060 KB
testcase_22 AC 133 ms
41,196 KB
testcase_23 WA -
testcase_24 AC 133 ms
41,372 KB
testcase_25 WA -
testcase_26 AC 135 ms
41,360 KB
testcase_27 AC 138 ms
41,684 KB
testcase_28 AC 134 ms
41,336 KB
testcase_29 AC 140 ms
41,956 KB
testcase_30 AC 135 ms
41,464 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

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