結果
問題 | No.2099 [Cherry Alpha B] Time Machine |
ユーザー |
|
提出日時 | 2022-10-14 22:12:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 760 bytes |
コンパイル時間 | 1,904 ms |
コンパイル使用メモリ | 192,288 KB |
最終ジャッジ日時 | 2025-02-08 04:07:27 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 71 WA * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef _RUTHEN#include <debug.hpp>#else#define show(...) true#endifusing ll = long long;#define rep(i, n) for (int i = 0; i < (n); i++)template <class T> using V = vector<T>;int main() {ios::sync_with_stdio(false);cin.tie(0);ll T, X, A, Y, B;cin >> T >> X >> A >> Y >> B;ll ans = 1LL << 60;for (int i = 0; i <= 100000000; i++) {ll cur = X * i, curd = A * i;if (curd <= T) {ans = min(ans, cur + T - curd);} else {// curd > Tll d = curd - T;ll q = (d + B - 1) / B;ll r = q * B - d;ans = min(ans, cur + q * Y + r);}}cout << ans << '\n';return 0;}