結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー ntuda
提出日時 2023-12-17 21:53:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 266 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 59,116 KB
最終ジャッジ日時 2024-09-27 08:08:18
合計ジャッジ時間 5,187 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 64 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
X, A = map(int, input().split())
Y, B = map(int, input().split())
ans = 10 ** 15 + 1
tmp = 10 ** 15
y = max(-(T//B),0)
while ans > tmp:
    ans = tmp
    x = (T + B * y) // A
    d = (T + B * y) % A
    tmp = X * x + Y * y + d
    y += 1
print(ans)
0