結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー みここみここ
提出日時 2022-12-12 03:44:51
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 428 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 69,468 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 03:56:10
合計ジャッジ時間 14,610 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 62 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;

const ll INF = 1000000000000000000;

int main()
{
    ll t, x, a, y, b;
    cin >> t >> x >> a >> y >> b;
    ll ans = INF;
    for(int i = 0; i <= abs(t) + a + b; i++)
    {
        ll d = t + b * i;
        if(d < 0)
        {
            continue;
        }
        int j = d / a;
        ans = min(ans, i * y + j * x + d % a);
    }
    cout << ans << endl;
}
0