- #1
bamia
- 4
- 2
Hello everyone,
I hope I'm not intruding with too simple of a request for help.
I have this math problem:
A rack space with 100 slots for plastic crates. I have two type of crates, one with 20 dividers weighing 5 grams and one with 60 dividers weighing 25 grams. I want to add crates to achieve the largest number of dividers while not exceeding 1000 grams.
so here I go:
n= # of 20 divider crate weighing 5 grams
m= # of 60 divider crate weighing 25 grams
w <= 1000 grams (Weight can't exceed 1000 grams)
n+m = 100 (total number of crates)
m=100-n
5n+25m=w (weight of the crate dividers)
5n+2500-25n=w
2500-20n=w
And then I'm stuck.
I can work out the solution by writing code to fill the rack with the 20 divider crates with a total of 500 grams and then replace one crate at time with a 60 divider one while testing for max total weight and total number of dividers and I get a result of 75n and 25m for a total dividers of 3000 weighing 1000 grams.
I can prove the same logic to work by changing the numbers a bit; for example with the second crate weighing 25 grams but having only 10 dividers instead of 60 I get 100n and 0m with a total weight of 500 grams.
Now are there equations to do this?
Thanks a lot
MOD EDIT: added some commentary in blue and moved from a technical forum, hence no template.
I hope I'm not intruding with too simple of a request for help.
I have this math problem:
A rack space with 100 slots for plastic crates. I have two type of crates, one with 20 dividers weighing 5 grams and one with 60 dividers weighing 25 grams. I want to add crates to achieve the largest number of dividers while not exceeding 1000 grams.
so here I go:
n= # of 20 divider crate weighing 5 grams
m= # of 60 divider crate weighing 25 grams
w <= 1000 grams (Weight can't exceed 1000 grams)
n+m = 100 (total number of crates)
m=100-n
5n+25m=w (weight of the crate dividers)
5n+2500-25n=w
2500-20n=w
And then I'm stuck.
I can work out the solution by writing code to fill the rack with the 20 divider crates with a total of 500 grams and then replace one crate at time with a 60 divider one while testing for max total weight and total number of dividers and I get a result of 75n and 25m for a total dividers of 3000 weighing 1000 grams.
I can prove the same logic to work by changing the numbers a bit; for example with the second crate weighing 25 grams but having only 10 dividers instead of 60 I get 100n and 0m with a total weight of 500 grams.
Now are there equations to do this?
Thanks a lot
MOD EDIT: added some commentary in blue and moved from a technical forum, hence no template.
Last edited by a moderator: