Calculating maximum amount of objects by weight in a container

187 Views Asked by At

first time posting, with a probably very simple question for you. This is something that I need for work:

I have a container to fill with exactly 250 objects, and a maximum weight capacity of 2339g I have two kinds of objects to fill the container with:

  • The primary objects that I want to use, with a weight of 18g each
  • The filler objects, with a weight of 5g each.

What I want to do is fill the container with as many primary objects as possible, and then fill the rest of the remaining 250 spaces with filler objects. I cannot exceed the maximum weight capacity of 2339g.

I could have solved this in 5 minutes whe I was at highscool, but those days are long gone... Please advise if the format of the question is not appropriate.

Many thanks!

1

There are 1 best solutions below

6
On BEST ANSWER

Let $x$ and $y$ denote the number of primary and filler objects, respectively. We want to solve the following system of inequalities $$18x+5y\leq2339\\x+y=250$$ We can rearrange the second equation into $y=250-x$ and plug it into the first one. Simplify the inequality, and you will have $$ 13x\leq 1089$$ The highest integer value of $x$ that you can have is 83, and so you can fill in 83 primary and 167 filler objects.

Indeed, $83(18)+167(5)=2329<2339$ and $84(18)+166(5)=2342>2339$ so 83 is the maximum number of primary objects that you can fill in