結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー aaaaaaaaaa2230
提出日時 2022-10-14 22:22:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 269 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 82,448 KB
実行使用メモリ 75,556 KB
最終ジャッジ日時 2024-06-26 15:34:24
合計ジャッジ時間 14,299 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 69 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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