結果

問題 No.176 2種類の切手
ユーザー kenkooookenkoooo
提出日時 2015-04-03 13:49:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 53 ms / 1,000 ms
コード長 803 bytes
コンパイル時間 1,986 ms
コンパイル使用メモリ 74,808 KB
実行使用メモリ 36,948 KB
最終ジャッジ日時 2024-04-16 22:03:18
合計ジャッジ時間 4,514 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
36,604 KB
testcase_01 AC 50 ms
36,780 KB
testcase_02 AC 52 ms
36,276 KB
testcase_03 AC 53 ms
36,576 KB
testcase_04 AC 52 ms
36,820 KB
testcase_05 AC 51 ms
36,296 KB
testcase_06 AC 51 ms
36,708 KB
testcase_07 AC 51 ms
36,780 KB
testcase_08 AC 50 ms
36,576 KB
testcase_09 AC 51 ms
36,576 KB
testcase_10 AC 52 ms
36,500 KB
testcase_11 AC 51 ms
36,576 KB
testcase_12 AC 50 ms
36,948 KB
testcase_13 AC 50 ms
36,636 KB
testcase_14 AC 49 ms
36,752 KB
testcase_15 AC 49 ms
36,404 KB
testcase_16 AC 49 ms
36,556 KB
testcase_17 AC 48 ms
36,708 KB
testcase_18 AC 51 ms
36,688 KB
testcase_19 AC 49 ms
36,924 KB
testcase_20 AC 49 ms
36,792 KB
testcase_21 AC 50 ms
36,836 KB
testcase_22 AC 51 ms
36,924 KB
testcase_23 AC 52 ms
36,820 KB
testcase_24 AC 50 ms
36,708 KB
testcase_25 AC 50 ms
36,272 KB
testcase_26 AC 49 ms
36,664 KB
testcase_27 AC 51 ms
36,636 KB
testcase_28 AC 49 ms
36,296 KB
testcase_29 AC 50 ms
36,624 KB
testcase_30 AC 50 ms
36,296 KB
testcase_31 AC 51 ms
36,816 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;; i++) {
			int j = (T - B * i + A - 1) / A;
			long next = B * i + A * j;

			min = Math.min(min, next);
			if (B * i > T || i > A) {
				break;
			}
		}

		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