Maximum Item Profit
You have n units of a base material. You want to use this material to create items and maximize your profit.
There are two types of items you can create:
- Basic Item: You can create an unlimited number of basic items. Each basic item costs c0 units of base material and yields d0 profit.
- Special Items: There are m different types of special items. For each special item type i (from 1 to m), you have ai units of a specific unique resource. Creating one special item of type i requires bi units of its unique resource and ci units of the base material, yielding di profit.
Find the maximum possible profit you can achieve by choosing the optimal combination of basic and special items to create.
Example 1:
Input: n = 10, m = 2 ,c0 = 2, d0 = 1 , specials : [[7,3,2,100],[12,3,1,10]]
Output: 241
Explanation:
Best choice:
- 2 buns (type 1)
- 4 buns (type 2)
- 1 plain bun
Example 2:
Input: n = 100, m = 1 ,c0 = 25, d0 = 50 , specials: [[15,5,20,10]]
Output: 200
Explanation:
Only plain buns are optimal:
- 4 buns → 4 × 50 = 200
Now Your Turn!
Pick the correct output for the given inputInput: n = 10, m = 1, c0 = 2, d0 = 1 , specials= [[2,1,2,10]]
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= n <= 1000
- 1 <= m <= 10
- 1 <= c0, d0 <= 100
- 1 <= ai, bi, ci, di <= 100