結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
41,492 KB
testcase_01 AC 130 ms
41,072 KB
testcase_02 AC 127 ms
41,480 KB
testcase_03 AC 130 ms
41,192 KB
testcase_04 AC 131 ms
41,380 KB
testcase_05 AC 119 ms
40,340 KB
testcase_06 AC 128 ms
41,272 KB
testcase_07 AC 131 ms
41,504 KB
testcase_08 AC 129 ms
41,284 KB
testcase_09 AC 131 ms
41,248 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 131 ms
41,248 KB
testcase_13 AC 132 ms
41,300 KB
testcase_14 AC 133 ms
41,144 KB
testcase_15 AC 132 ms
41,112 KB
testcase_16 AC 131 ms
41,164 KB
testcase_17 WA -
testcase_18 AC 132 ms
41,408 KB
testcase_19 AC 131 ms
41,112 KB
testcase_20 AC 120 ms
40,088 KB
testcase_21 AC 133 ms
41,296 KB
testcase_22 AC 119 ms
40,284 KB
testcase_23 WA -
testcase_24 AC 132 ms
41,424 KB
testcase_25 WA -
testcase_26 AC 120 ms
40,292 KB
testcase_27 AC 133 ms
41,176 KB
testcase_28 AC 133 ms
41,352 KB
testcase_29 AC 132 ms
41,216 KB
testcase_30 AC 133 ms
41,328 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);
		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(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