結果

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

ソースコード

diff #

def main():
    from sys import stdin, setrecursionlimit
    # setrecursionlimit(1000000)
    input = stdin.readline
    def iinput(): return int(input())
    def sinput(): return input().rstrip()
    def i0input(): return int(input()) - 1
    def linput(): return list(input().split())
    def liinput(): return list(map(int, input().split()))
    def miinput(): return map(int, input().split())
    def li0input(): return list(map(lambda x: int(x) - 1, input().split()))
    def mi0input(): return map(lambda x: int(x) - 1, input().split())
    INF = 1000000000000000000
    MOD = 1000000007

    T = iinput()
    X, A = miinput()
    Y, B = miinput()

    ans = INF
    for i in range(10101010):
        Z = T + B * i
        if Z >= 0:
            ans = min(ans, Z // A * X + i * Y + Z % A)
    print(ans)


main()
0