此推文列出了中餐厅1的翅膀的可能订单:
订购披萨时,我通常会计算出什么尺寸能给我带来最佳的披萨价格比,这很简单。但是,要最小化这家餐厅的订单价格并不是一件容易的事,因此我想为在该餐厅的下一份订单做好准备。
挑战
给定一个大于或等于的整数,您的任务是返回一个可能的订单,以最小化价格(总体上最便宜)和交易数量。
例
如果我要订购 Wings,事实证明最好的讨价还价将花费。但是,有多个订单将花费该金额,即:
[50,50],[25,25,50],[25,25,25,25]
由于第一个订单将使用最少的交易(),结果将是[50,50]
。
规则
- 输入将是某个整数
- 输出将是订单大小的列表/数组/ ...,总计为,并将订单价格最小化
- 您可以选择退回所有可能的订单
测试用例
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)
注意:这些测试用例列出了所有可能的输出,包括价格,您只需要输出一个,而无需输出价格!
1:您可以在此处以CSV格式找到数据。