結果

問題 No.176 2種類の切手
ユーザー machy
提出日時 2015-06-17 22:34:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 506 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 74,204 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-08 03:23:43
合計ジャッジ時間 1,785 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;
typedef long long LL;

int main(){
    LL A, B, T;
    cin >> A >> B >> T;
    if(A > B) swap(A, B);
    LL bc = (T + B-1) / B;
    LL ans = (1LL<<60);
    for(LL i = 0; i <= A; i++){
        if(bc - i < 0) break;
        LL ac = (max<LL>(0, T - (bc-i)*B) + A - 1) / A;
        ans = min(ans, A*ac + B*(bc-i));
    }
    cout << ans << endl;
    return 0;
}
0