This tweet lists the possible orders for Wings of a Chinese restaurant1:
When ordering Pizza I usually calculate what size gives me the best Pizza-price ratio which is a simple calculation. However minimizing the price of an order at this restaurant isn't such a simple task, so I'd like to be prepared for my next order there.
Challenge
Given an integer greater or equal to \$4\$, your task is to return one possible order which minimizes the price (overall cheapest) and the number of deals.
Example
If I were to order \$100\$ Wings, it turns out the best bargain will cost \$$111.20\$. However there are multiple orders which will cost that amount, namely:
[50,50],[25,25,50],[25,25,25,25]
Since the first order will use the least amount of deals (\$2\$) the result will be [50,50]
.
Rules
- Input will be some integer \$n \geq 4\$
- Output will be a list/array/... of order sizes that sum up to \$n\$ and minimize the order's price
- you may choose to return all possible orders
Testcases
4 -> [4] (4.55)
23 -> [23] (26.10)
24 -> [6,18],[9,15],[12,12] (27.20)
31 -> [6,25] (34.60)
32 -> [4,28],[6,26],[7,25] (35.75)
33 -> [4,29],[5,28],[6,27],[7,26],[8,25] (36.90)
34 -> [6,28],[9,25] (38.00)
35 -> [35] (39.15)
125 -> [125] (139.00)
200 -> [25,50,125] (222.40)
201 -> [26,50,125] (223.55)
250 -> [125,125] (278.00)
251 -> [26,50,50,125] (279.15)
418 -> [15,28,125,125,125],[18,25,125,125,125] (465.20)
1001 -> [26,50,50,125,125,125,125,125,125,125] (1113.15)
12345 -> [15,80,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125],[25,70,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125],[45,50,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125] (13728.10)
Note: These testcases list all possible outputs including the price, you're only required to output one and you're not required to output the price!
1: You can find the data as a CSV here.