結果

問題 No.176 2種類の切手
ユーザー kenkooookenkoooo
提出日時 2015-04-03 13:44:39
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 796 bytes
コンパイル時間 2,354 ms
コンパイル使用メモリ 75,120 KB
実行使用メモリ 52,080 KB
最終ジャッジ日時 2024-04-16 22:03:13
合計ジャッジ時間 4,812 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
36,820 KB
testcase_01 AC 50 ms
36,296 KB
testcase_02 AC 50 ms
36,468 KB
testcase_03 AC 50 ms
36,708 KB
testcase_04 AC 50 ms
36,948 KB
testcase_05 AC 52 ms
36,636 KB
testcase_06 AC 53 ms
36,576 KB
testcase_07 AC 51 ms
36,572 KB
testcase_08 AC 53 ms
36,708 KB
testcase_09 AC 52 ms
36,724 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 50 ms
36,836 KB
testcase_13 AC 51 ms
36,532 KB
testcase_14 AC 49 ms
36,704 KB
testcase_15 AC 49 ms
36,816 KB
testcase_16 AC 50 ms
36,340 KB
testcase_17 WA -
testcase_18 AC 50 ms
36,820 KB
testcase_19 AC 52 ms
36,508 KB
testcase_20 AC 50 ms
36,820 KB
testcase_21 AC 49 ms
36,992 KB
testcase_22 AC 50 ms
36,780 KB
testcase_23 AC 50 ms
36,572 KB
testcase_24 AC 50 ms
36,652 KB
testcase_25 WA -
testcase_26 AC 49 ms
36,604 KB
testcase_27 AC 49 ms
36,792 KB
testcase_28 AC 51 ms
36,668 KB
testcase_29 AC 51 ms
36,564 KB
testcase_30 AC 48 ms
36,700 KB
testcase_31 AC 49 ms
36,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;

public class Main {

	public static void main(String[] args) {
		int A = nextInt();
		int B = nextInt();
		int T = nextInt();
		long min = Long.MAX_VALUE;

		for (int i = 0; B * i <= T && i <= A; i++) {
			long next = B * i + (T - B * i) / A * A;
			if (next < T) {
				next += A;
			}

			min = Math.min(min, next);
		}

		System.out.println(min);

	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return -1;
	}
}
0