結果
問題 |
No.176 2種類の切手
|
ユーザー |
|
提出日時 | 2016-10-04 18:59:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 579 bytes |
コンパイル時間 | 496 ms |
コンパイル使用メモリ | 65,280 KB |
実行使用メモリ | 10,148 KB |
最終ジャッジ日時 | 2024-11-21 16:28:34 |
合計ジャッジ時間 | 5,931 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 TLE * 2 |
ソースコード
#include <iostream> typedef long long ll; using namespace std; template <class T> void setmin(T & a, T const & b) { if (b < a) a = b; } const ll inf = ll(1e18)+9; int main() { ll a, b, t; cin >> a >> b >> t; ll ans = inf; if (a == 1) { ans = t; } else if (a == 2) { if (t % 2 == 0 or (b % 2 == 1 and b <= t)) { ans = t; } else { ans = t + 1; } } else { for (ll i = 0; i <= t+a; i += a) { setmin(ans, i + (t-i + b-1)/b*b); } } cout << ans << endl; return 0; }