結果

問題 No.176 2種類の切手
ユーザー ぴろずぴろず
提出日時 2015-04-03 00:00:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 484 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 74,476 KB
実行使用メモリ 41,568 KB
最終ジャッジ日時 2024-04-16 21:32:01
合計ジャッジ時間 7,429 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,192 KB
testcase_01 AC 129 ms
41,212 KB
testcase_02 AC 132 ms
41,556 KB
testcase_03 AC 128 ms
41,272 KB
testcase_04 AC 129 ms
41,156 KB
testcase_05 AC 132 ms
40,952 KB
testcase_06 AC 134 ms
41,568 KB
testcase_07 AC 133 ms
41,552 KB
testcase_08 AC 132 ms
41,436 KB
testcase_09 AC 133 ms
41,224 KB
testcase_10 AC 133 ms
41,208 KB
testcase_11 AC 130 ms
41,312 KB
testcase_12 AC 134 ms
41,268 KB
testcase_13 AC 131 ms
41,096 KB
testcase_14 AC 133 ms
41,176 KB
testcase_15 AC 134 ms
41,500 KB
testcase_16 AC 135 ms
41,320 KB
testcase_17 AC 134 ms
41,564 KB
testcase_18 AC 132 ms
41,492 KB
testcase_19 AC 132 ms
41,308 KB
testcase_20 AC 132 ms
41,180 KB
testcase_21 AC 132 ms
41,028 KB
testcase_22 AC 133 ms
41,408 KB
testcase_23 AC 133 ms
41,440 KB
testcase_24 AC 120 ms
40,096 KB
testcase_25 AC 133 ms
41,336 KB
testcase_26 AC 132 ms
41,124 KB
testcase_27 AC 135 ms
41,196 KB
testcase_28 AC 136 ms
41,360 KB
testcase_29 AC 136 ms
41,372 KB
testcase_30 AC 136 ms
41,052 KB
testcase_31 AC 134 ms
41,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no176;

import java.util.Scanner;

public class Main {

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

}
0