← Questions

Price a macaron order with set discounts

0
OpenAICodingLast asked Oct 2026

A bakery sells macarons in up to five flavors, all at the same unit price. An order gives how many of each flavor the customer wants. The baker packs the order into sets of distinct flavors, at most one of each flavor per set, by repeatedly taking one macaron of every flavor still left. Each set gets a discount that grows with the number of distinct flavors in it (a full set of five is the cheapest per macaron). Return the order's total price, in cents to avoid floating-point error.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding