結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー ygd.ygd.
提出日時 2022-10-14 21:50:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 420 ms / 2,000 ms
コード長 987 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 76,920 KB
最終ジャッジ日時 2023-09-08 20:52:07
合計ジャッジ時間 23,816 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 274 ms
76,364 KB
testcase_01 AC 274 ms
76,600 KB
testcase_02 AC 267 ms
76,812 KB
testcase_03 AC 270 ms
76,720 KB
testcase_04 AC 127 ms
76,440 KB
testcase_05 AC 275 ms
76,472 KB
testcase_06 AC 274 ms
76,652 KB
testcase_07 AC 270 ms
76,588 KB
testcase_08 AC 267 ms
76,820 KB
testcase_09 AC 270 ms
76,856 KB
testcase_10 AC 270 ms
76,676 KB
testcase_11 AC 270 ms
76,604 KB
testcase_12 AC 272 ms
76,588 KB
testcase_13 AC 274 ms
76,332 KB
testcase_14 AC 126 ms
76,608 KB
testcase_15 AC 274 ms
76,588 KB
testcase_16 AC 272 ms
76,704 KB
testcase_17 AC 278 ms
76,488 KB
testcase_18 AC 393 ms
76,692 KB
testcase_19 AC 394 ms
76,740 KB
testcase_20 AC 404 ms
76,584 KB
testcase_21 AC 406 ms
76,756 KB
testcase_22 AC 275 ms
76,584 KB
testcase_23 AC 274 ms
76,552 KB
testcase_24 AC 396 ms
76,856 KB
testcase_25 AC 405 ms
76,604 KB
testcase_26 AC 400 ms
76,908 KB
testcase_27 AC 268 ms
76,708 KB
testcase_28 AC 272 ms
76,652 KB
testcase_29 AC 119 ms
76,336 KB
testcase_30 AC 268 ms
76,528 KB
testcase_31 AC 271 ms
76,588 KB
testcase_32 AC 273 ms
76,596 KB
testcase_33 AC 266 ms
76,552 KB
testcase_34 AC 120 ms
76,240 KB
testcase_35 AC 268 ms
76,588 KB
testcase_36 AC 269 ms
76,484 KB
testcase_37 AC 269 ms
76,596 KB
testcase_38 AC 404 ms
76,636 KB
testcase_39 AC 396 ms
76,624 KB
testcase_40 AC 402 ms
76,520 KB
testcase_41 AC 274 ms
76,596 KB
testcase_42 AC 397 ms
76,676 KB
testcase_43 AC 269 ms
76,468 KB
testcase_44 AC 410 ms
76,476 KB
testcase_45 AC 401 ms
76,640 KB
testcase_46 AC 271 ms
76,652 KB
testcase_47 AC 399 ms
76,404 KB
testcase_48 AC 267 ms
76,804 KB
testcase_49 AC 123 ms
76,424 KB
testcase_50 AC 268 ms
76,472 KB
testcase_51 AC 269 ms
76,360 KB
testcase_52 AC 271 ms
76,464 KB
testcase_53 AC 123 ms
76,332 KB
testcase_54 AC 264 ms
76,648 KB
testcase_55 AC 393 ms
76,584 KB
testcase_56 AC 270 ms
76,688 KB
testcase_57 AC 270 ms
76,412 KB
testcase_58 AC 273 ms
76,572 KB
testcase_59 AC 271 ms
76,812 KB
testcase_60 AC 272 ms
76,596 KB
testcase_61 AC 271 ms
76,484 KB
testcase_62 AC 269 ms
76,856 KB
testcase_63 AC 269 ms
76,472 KB
testcase_64 AC 269 ms
76,376 KB
testcase_65 AC 383 ms
76,920 KB
testcase_66 AC 266 ms
76,728 KB
testcase_67 AC 405 ms
76,636 KB
testcase_68 AC 269 ms
76,620 KB
testcase_69 AC 270 ms
76,644 KB
testcase_70 AC 269 ms
76,600 KB
testcase_71 AC 420 ms
76,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
#import math
#import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
from collections import defaultdict 
#from collections import deque
#import copy #DeepCopy: hoge = [_[:] for _ in hogehoge]
#from functools import lru_cache
#@lru_cache(maxsize=None)
MOD = pow(10,9) + 7
#MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

def main():
    T = int(input())
    X,A = map(int,input().split())
    Y,B = map(int,input().split())
    MAX = pow(10,7) + 5

    ans = 1 << 60
    # 戻る回数
    for i in range(MAX):
        nokori = T + B*i
        if nokori < 0:
            continue
        temp = Y*i
        j = nokori//A
        temp += j*X + (nokori - j*A)
        # print(i,temp)
        ans = min(ans, temp)
    print(ans)

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