結果

問題 No.158 奇妙なお使い
ユーザー maspy
提出日時 2020-03-18 12:16:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 782 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2024-12-14 01:40:23
合計ジャッジ時間 45,960 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 RE * 4 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from functools import lru_cache

# %%
A = tuple(map(int, readline().split()))
DB = int(readline())
B = tuple(map(int, readline().split()))
DC = int(readline())
C = tuple(map(int, readline().split()))


# %%
def f(X, Y, Z):
    ret = 0
    for cost, gain in ((DB, B), (DC, C)):
        x = cost // 1000
        if X < x:
            x = X
        cost -= 1000 * x
        y = cost // 100
        if Y < y:
            y = Y
        cost -= 100 * y
        if cost > Z:
            continue
        n = 1 + f(X - x + gain[0], Y - y + gain[1], Z - cost + gain[2])
        if ret < n:
            ret = n
    return ret


# %%
print(f(*A))
0