結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-10-14 22:23:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,840 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 75,136 KB
最終ジャッジ日時 2024-06-26 15:40:24
合計ジャッジ時間 16,167 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 72
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
x,a = map(int,input().split())
y,b = map(int,input().split())
ans = 10**20

for i in range(2*10**7+5):
    now = a*i
    dif = max(now-t,0)
    j = (dif+b-1)//b
    # print(i,now,dif,j,now-j*b)
    now -= j*b
    ans = min(ans,i*x+j*y+t-now)
print(ans)
0