結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー kept1994kept1994
提出日時 2022-11-03 20:43:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 71,672 KB
最終ジャッジ日時 2023-09-25 04:19:22
合計ジャッジ時間 9,011 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,296 KB
testcase_01 AC 71 ms
71,616 KB
testcase_02 AC 70 ms
71,468 KB
testcase_03 AC 68 ms
71,532 KB
testcase_04 WA -
testcase_05 AC 71 ms
71,420 KB
testcase_06 AC 70 ms
71,516 KB
testcase_07 AC 69 ms
71,308 KB
testcase_08 AC 68 ms
71,356 KB
testcase_09 AC 70 ms
71,296 KB
testcase_10 AC 70 ms
71,504 KB
testcase_11 AC 68 ms
71,292 KB
testcase_12 AC 70 ms
71,292 KB
testcase_13 AC 69 ms
71,540 KB
testcase_14 WA -
testcase_15 AC 72 ms
71,408 KB
testcase_16 AC 70 ms
71,456 KB
testcase_17 AC 70 ms
71,292 KB
testcase_18 AC 70 ms
71,468 KB
testcase_19 AC 71 ms
71,312 KB
testcase_20 AC 69 ms
71,356 KB
testcase_21 AC 68 ms
71,292 KB
testcase_22 AC 69 ms
71,556 KB
testcase_23 AC 71 ms
71,384 KB
testcase_24 AC 74 ms
71,552 KB
testcase_25 AC 71 ms
71,104 KB
testcase_26 AC 70 ms
71,296 KB
testcase_27 AC 69 ms
71,308 KB
testcase_28 AC 69 ms
71,256 KB
testcase_29 WA -
testcase_30 AC 70 ms
71,396 KB
testcase_31 AC 70 ms
71,392 KB
testcase_32 AC 69 ms
71,372 KB
testcase_33 AC 70 ms
71,104 KB
testcase_34 WA -
testcase_35 AC 71 ms
71,420 KB
testcase_36 AC 72 ms
71,464 KB
testcase_37 AC 71 ms
71,380 KB
testcase_38 AC 70 ms
71,252 KB
testcase_39 AC 68 ms
71,360 KB
testcase_40 WA -
testcase_41 AC 68 ms
71,284 KB
testcase_42 AC 70 ms
71,288 KB
testcase_43 AC 70 ms
71,628 KB
testcase_44 AC 70 ms
71,484 KB
testcase_45 AC 74 ms
71,260 KB
testcase_46 AC 70 ms
71,372 KB
testcase_47 AC 71 ms
71,400 KB
testcase_48 AC 72 ms
71,132 KB
testcase_49 WA -
testcase_50 AC 71 ms
71,628 KB
testcase_51 AC 70 ms
71,492 KB
testcase_52 AC 78 ms
71,436 KB
testcase_53 WA -
testcase_54 AC 70 ms
71,380 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 AC 70 ms
71,216 KB
testcase_58 AC 70 ms
71,404 KB
testcase_59 WA -
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
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
        back = A - q
        tt, ss = divmod(back, B)
        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
        tt, ss = divmod(back, A)
        print((p + 1) * Y + tt * X + ss)
    return

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