結果

問題 No.176 2種類の切手
ユーザー fine
提出日時 2017-03-21 00:23:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 395 bytes
コンパイル時間 1,522 ms
コンパイル使用メモリ 165,580 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-07-05 04:40:32
合計ジャッジ時間 2,430 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll INF = 2e9;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, t;
	cin >> a >> b >> t;
	ll ans = INF;
	for (ll i = 0; i < a; i++) {
		if (t < b * i) {
			ans = min(ans, b * i);
			break;
		}
		ll cnt = (t - b * i + a - 1) / a;
		ans = min(ans, cnt * a + b * i);
	}
	cout << ans << endl;
	return 0;
}
0