結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー keisuke6
提出日時 2022-08-14 23:31:04
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 3,148 ms
コンパイル使用メモリ 244,124 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-26 12:48:17
合計ジャッジ時間 34,926 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    long long T, X, A, Y, B;
    cin >> T >> X >> A >> Y >> B;
    long long ans = (T/A)*X + T%A;
    long long now = T - T%A;
    for(int i = 0; i < 2*(1e7); ++i) {
        now += A;
        long long wait = T - (now - ((now-T-1)/B+1)*B);
        ans = min(ans, (now/A)*X + (now-(T-wait))/B*Y + wait);
    }
    cout << ans << endl;
}
0