Problem 103841 · easy · Phase 01 Prerequisites & Setup

Bulk Discount Cart

loops · conditionals · arithmetic

A wholesale shop gives 20% off any cart line where the customer buys 10 or more of the same item. cart is a list of [price_cents, quantity] lines. For each line compute price_cents * quantity; if quantity >= 10, the line costs 80% of that, rounded down to a whole cent. Return the cart total in cents.

Examples

Input:  cart = [[250, 2], [100, 10]]
Output: 1300
Explanation: 500 + (1000 with 20% off = 800) = 1300

Input:  cart = [[199, 3]]
Output: 597

Constraints

  • 0 <= len(cart) <= 1000, 1 <= price_cents <= 10**5, 1 <= quantity <= 1000

Goals

  • Compute a per-line total and apply a conditional discount to it
  • Use integer arithmetic on cents to avoid rounding surprises
Starting Python…