結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー 🍮かんプリン
提出日時 2022-10-17 02:50:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 234 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 1,593 ms
コンパイル使用メモリ 165,960 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 19:51:57
合計ジャッジ時間 18,998 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 72
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2022.10.17 02:50:37
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;


constexpr long long LLINF = 1e18 + 1;

int main() {
    int t;cin >> t;
    int x,a,y,b;cin >> x >> a >> y >> b;
    ll ans = LLINF;
    for (int i = max(0,(b-1-t)/b); i <= 20000001; i++) {
        ll j = max(0LL,((ll)b*i+t)/a);
        ans = min(ans,(x-a)*j+(ll)(y+b)*i+t);
    }
    cout << ans << endl;
    return 0;
}
0