結果

問題 No.3696 Betting Machine
コンテスト
ユーザー Kude
提出日時 2026-09-09 22:00:05
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 657 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 57 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2026-09-09 22:00:24
合計ジャッジ時間 5,908 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from functools import cache
from fractions import Fraction

s, t, n = map(int, input().split())
pab = [tuple(map(int, input().split())) for _ in range(3)]

@cache
def f(n, w):
    if w >= t:
        return Fraction(1)
    if w <= 0:
        return Fraction(0)
    if n == 0:
        return Fraction(0)
    return max(
        sum(Fraction(p, 100) * f(n - 1, w - x + a * x // b) for p, a, b in pab)
        for x in range(1, w + 1))

ans = f(n, s)
print(ans.numerator * 100 // ans.denominator)

d = []
for x in range(1, s + 1):
    if sum(Fraction(p, 100) * f(n - 1, s - x + a * x // b) for p, a, b in pab) == ans:
        d.append(x)
print(len(d))
print(*d)
0