結果

問題 No.176 2種類の切手
ユーザー keikei
提出日時 2016-10-01 11:45:04
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 59,604 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 09:10:20
合計ジャッジ時間 1,450 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 WA -
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	long long A, B, T, sum;
	cin >> A >> B >> T;
	if (A >= T && B >= T) { cout << ((A > B) ? A : B) << endl; return 0; }
	else if (A >= T) { cout << A << endl; return 0; }
	else if (B >= T) { cout << B << endl; return 0; }
	long long ans = T + T;

	for (int y = 0; y <= A; y++) {
		sum = B*y + ((T - B*y + A - 1) / A) * A;
		if (sum >= T) {
			ans = min(ans, sum);
		}
		if (B*y >= T) { break; }
	}

	cout << ans << endl;
	return 0;
}
0