結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー 👑 rin204
提出日時 2022-10-15 14:34:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 908 ms
コンパイル使用メモリ 82,184 KB
実行使用メモリ 60,324 KB
最終ジャッジ日時 2024-06-26 19:49:14
合計ジャッジ時間 8,491 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 72
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
x, a = map(int, input().split())
y, b = map(int, input().split())

x = min(x, a)
ans = 1 << 60
for i in range(10 ** 7 + 1):
    d = t + b * i
    if d < 0:
        continue
    j = d // a * x + d % a
    ans = min(ans, i * y + j)
print(ans)
0