結果

問題 No.176 2種類の切手
ユーザー ぴろずぴろず
提出日時 2015-04-02 23:59:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 2,048 ms
コンパイル使用メモリ 74,012 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-04-16 21:31:16
合計ジャッジ時間 7,265 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,412 KB
testcase_01 AC 116 ms
40,340 KB
testcase_02 AC 132 ms
41,444 KB
testcase_03 AC 132 ms
41,504 KB
testcase_04 AC 131 ms
41,280 KB
testcase_05 AC 116 ms
40,384 KB
testcase_06 AC 132 ms
41,248 KB
testcase_07 AC 132 ms
41,248 KB
testcase_08 AC 128 ms
41,328 KB
testcase_09 AC 134 ms
41,368 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 130 ms
41,268 KB
testcase_13 AC 132 ms
41,280 KB
testcase_14 AC 128 ms
41,364 KB
testcase_15 AC 129 ms
41,344 KB
testcase_16 AC 121 ms
39,880 KB
testcase_17 WA -
testcase_18 AC 129 ms
41,400 KB
testcase_19 AC 131 ms
41,276 KB
testcase_20 AC 132 ms
41,172 KB
testcase_21 AC 130 ms
41,048 KB
testcase_22 AC 133 ms
41,156 KB
testcase_23 WA -
testcase_24 AC 131 ms
41,436 KB
testcase_25 WA -
testcase_26 AC 131 ms
41,616 KB
testcase_27 AC 131 ms
41,096 KB
testcase_28 AC 131 ms
41,172 KB
testcase_29 AC 116 ms
40,136 KB
testcase_30 AC 133 ms
41,064 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;
			if (b * y >= t) {
				x = 0;
			}else{
				x = (t - (long)b * y + a - 1) / a;
			}
			ans = Math.min(a * x + b * y, ans);
		}
		System.out.println(ans);
	}

}
0