rights reserved. def apply_coupons(price: int, coupons: list[Coupon]) -> int: percent_coupons = [c for c in coupons if isinstance(c, PercentOffCoupon)] amount_coupons = [c for c in coupons if isinstance(c, AmountOffCoupon)] total: Decimal = Decimal(price) for c in percent_coupons: total = _apply_one(total, c) for c in amount_coupons: total = _apply_one(total, c) return floor_and_clamp(total) 修正後のクーポン適⽤ロジック PBT で検証済み • REQ2: 切り上げ・切り捨て処理 • REQ3. 顧客最適性 本番環境向け実装: 定率 OFF クーポンを先、 定額 OFF クーポンを後に 適⽤するのが最適