結果

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

ソースコード

diff #

t = int(input())
x, a = map(int, input().split())
y, b = map(int, input().split())
ans = float("inf")
for i in range(10**7):
  now = a * i
  tmp = x * i
  if now < t:
    tmp += t - now
  else:
    tmp += -((t - now) // b) * y
    tmp += (t - now) % b
  ans = min(ans, tmp)
print(ans)
0