結果

問題 No.176 2種類の切手
ユーザー kimiyuki
提出日時 2016-10-04 19:00:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 631 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 67,660 KB
実行使用メモリ 13,636 KB
最終ジャッジ日時 2024-11-21 16:31:47
合計ジャッジ時間 5,808 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize "O3,omit-frame-pointer,inline"
#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;
}
0