結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー kept1994kept1994
提出日時 2022-11-03 20:55:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 844 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 71,596 KB
最終ジャッジ日時 2023-09-25 04:28:50
合計ジャッジ時間 7,788 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,320 KB
testcase_01 AC 69 ms
71,196 KB
testcase_02 AC 69 ms
71,320 KB
testcase_03 AC 72 ms
71,272 KB
testcase_04 AC 74 ms
71,184 KB
testcase_05 AC 69 ms
71,124 KB
testcase_06 AC 69 ms
71,120 KB
testcase_07 AC 69 ms
71,300 KB
testcase_08 AC 72 ms
71,120 KB
testcase_09 AC 70 ms
71,096 KB
testcase_10 AC 72 ms
71,296 KB
testcase_11 AC 72 ms
71,264 KB
testcase_12 AC 69 ms
71,360 KB
testcase_13 AC 72 ms
71,332 KB
testcase_14 AC 72 ms
71,536 KB
testcase_15 AC 71 ms
71,264 KB
testcase_16 AC 70 ms
71,388 KB
testcase_17 AC 71 ms
71,296 KB
testcase_18 AC 78 ms
71,116 KB
testcase_19 AC 70 ms
71,308 KB
testcase_20 AC 71 ms
71,300 KB
testcase_21 AC 70 ms
71,260 KB
testcase_22 AC 70 ms
71,052 KB
testcase_23 AC 69 ms
71,248 KB
testcase_24 AC 70 ms
71,116 KB
testcase_25 AC 72 ms
71,388 KB
testcase_26 AC 72 ms
71,440 KB
testcase_27 AC 71 ms
71,172 KB
testcase_28 AC 69 ms
71,120 KB
testcase_29 AC 70 ms
71,120 KB
testcase_30 AC 74 ms
70,984 KB
testcase_31 AC 71 ms
71,304 KB
testcase_32 AC 70 ms
71,292 KB
testcase_33 AC 72 ms
71,380 KB
testcase_34 AC 72 ms
71,292 KB
testcase_35 AC 71 ms
71,264 KB
testcase_36 AC 70 ms
71,204 KB
testcase_37 AC 69 ms
71,264 KB
testcase_38 AC 73 ms
71,260 KB
testcase_39 AC 71 ms
71,260 KB
testcase_40 AC 72 ms
71,276 KB
testcase_41 AC 74 ms
71,256 KB
testcase_42 AC 72 ms
70,976 KB
testcase_43 AC 79 ms
71,452 KB
testcase_44 AC 71 ms
71,500 KB
testcase_45 AC 71 ms
71,300 KB
testcase_46 AC 71 ms
71,544 KB
testcase_47 AC 72 ms
71,300 KB
testcase_48 AC 70 ms
70,980 KB
testcase_49 AC 71 ms
71,544 KB
testcase_50 AC 74 ms
71,176 KB
testcase_51 AC 73 ms
71,384 KB
testcase_52 AC 79 ms
71,472 KB
testcase_53 AC 70 ms
71,308 KB
testcase_54 AC 71 ms
71,124 KB
testcase_55 AC 73 ms
71,272 KB
testcase_56 AC 70 ms
71,304 KB
testcase_57 AC 70 ms
71,504 KB
testcase_58 AC 70 ms
71,296 KB
testcase_59 AC 70 ms
71,340 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
INF = 10 ** 16
def main():
    T = int(input())
    X, A = map(int, input().split())
    Y, B = map(int, input().split())
    if T > 0:
        p, q = divmod(T, A)
        path1 = p * X + q # A + walk
        if q == 0:
            print(path1)
            return
        back = A - q
        tt, ss = divmod(back, B)
        if ss == 0:
            path2 = (p + 1) * X + tt * Y
            print(min(path1, path2))
        else:
            backagain = B - ss
            path2 = (p + 1) * X + (tt + 1) * Y + backagain # A + B + walk
            print(min(path1, path2))
    else:
        p, q = divmod(-T, B)
        back = B - q
        if q == 0:
            print(p * Y)
        else:
            tt, ss = divmod(back, A)
            print((p + 1) * Y + tt * X + ss)
    return

if __name__ == '__main__':
    main()
0