2861. Maximum Number of Alloys
You are the owner of a company that creates alloys using various types of metals. There are
n
different types of metals available, and you have access tok
machines that can be used to create alloys. Each machine requires a specific amount of each metal type to create an alloy.For the
ith
machine to create an alloy, it needscomposition[i][j]
units of metal of typej
. Initially, you havestock[i]
units of metal typei
, and purchasing one unit of metal typei
costscost[i]
coins.Given integers
n
,k
,budget
, a 1-indexed 2D arraycomposition
, and 1-indexed arraysstock
andcost
, your goal is to maximize the number of alloys the company can create while staying within the budget ofbudget
coins.All alloys must be created with the same machine.
Return the maximum number of alloys that the company can create.
1 |
|