結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー kept1994kept1994
提出日時 2022-11-03 20:53:58
言語 PyPy3
(7.3.8)
結果
WA  
実行時間 -
コード長 840 bytes
コンパイル時間 424 ms
使用メモリ 75,964 KB
最終ジャッジ日時 2023-02-15 20:24:06
合計ジャッジ時間 10,733 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 86 ms
75,504 KB
testcase_01 AC 85 ms
75,868 KB
testcase_02 AC 86 ms
75,756 KB
testcase_03 AC 84 ms
75,744 KB
testcase_04 AC 85 ms
75,556 KB
testcase_05 AC 85 ms
75,448 KB
testcase_06 AC 84 ms
75,748 KB
testcase_07 AC 85 ms
75,672 KB
testcase_08 AC 85 ms
75,724 KB
testcase_09 AC 85 ms
75,712 KB
testcase_10 AC 85 ms
75,400 KB
testcase_11 AC 88 ms
75,452 KB
testcase_12 AC 85 ms
75,856 KB
testcase_13 AC 85 ms
75,476 KB
testcase_14 AC 84 ms
75,640 KB
testcase_15 AC 86 ms
75,500 KB
testcase_16 AC 85 ms
75,640 KB
testcase_17 AC 85 ms
75,704 KB
testcase_18 AC 84 ms
75,712 KB
testcase_19 AC 86 ms
75,828 KB
testcase_20 AC 84 ms
75,636 KB
testcase_21 AC 85 ms
75,480 KB
testcase_22 AC 85 ms
75,504 KB
testcase_23 AC 85 ms
75,492 KB
testcase_24 AC 85 ms
75,792 KB
testcase_25 AC 84 ms
75,456 KB
testcase_26 AC 85 ms
75,560 KB
testcase_27 AC 85 ms
75,820 KB
testcase_28 AC 85 ms
75,436 KB
testcase_29 AC 86 ms
75,716 KB
testcase_30 AC 85 ms
75,492 KB
testcase_31 AC 83 ms
75,700 KB
testcase_32 AC 84 ms
75,752 KB
testcase_33 AC 83 ms
75,836 KB
testcase_34 AC 85 ms
75,832 KB
testcase_35 AC 83 ms
75,532 KB
testcase_36 AC 84 ms
75,540 KB
testcase_37 AC 83 ms
75,788 KB
testcase_38 AC 83 ms
75,744 KB
testcase_39 AC 84 ms
75,476 KB
testcase_40 WA -
testcase_41 AC 84 ms
75,812 KB
testcase_42 AC 83 ms
75,656 KB
testcase_43 AC 83 ms
75,656 KB
testcase_44 AC 84 ms
75,732 KB
testcase_45 AC 83 ms
75,656 KB
testcase_46 AC 84 ms
75,716 KB
testcase_47 AC 83 ms
75,652 KB
testcase_48 AC 86 ms
75,720 KB
testcase_49 AC 84 ms
75,744 KB
testcase_50 AC 84 ms
75,744 KB
testcase_51 AC 84 ms
75,656 KB
testcase_52 AC 84 ms
75,508 KB
testcase_53 WA -
testcase_54 AC 83 ms
75,772 KB
testcase_55 WA -
testcase_56 AC 83 ms
75,768 KB
testcase_57 AC 84 ms
75,648 KB
testcase_58 AC 84 ms
75,560 KB
testcase_59 AC 83 ms
75,784 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)
        else:
            tt, ss = divmod(back, A)
            print((p + 1) * Y + tt * X + ss)
    return

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