# breaking it down medium

Ticket Bundles

Ride tickets: singles cost s, a 5-pack costs p. What's the cheapest way to get at least n rides? 🎟️

Sometimes a 5-pack beats buying 3 singles — sometimes not. Try every possible number of packs and print the cheapest total.

Example:

Input: n = 7, s = 3, p = 10 Output: 16

Trying 0 packs costs 7 × 3 = 21. Trying 1 pack (5 rides) plus 2 singles costs 10 + 6 = 16. Trying 2 packs costs 20. The cheapest option is 16.

💡 need a hint?

brk-ticket-bundles.py🔒 given lines are locked — write your code in between
loading...