
Let's imagine that they are candies. one sack of candy MUST have three red candy, two blue candy, and four green candy. How many sack of candies I could make with twelve red candies, seven blue candies, and eleven green candies?.
are there any formula on how to solve this? I know i can count manually but . I need the name / formula for the solution so i could properly change it in code form.. are there any keywords that I should search for etc etc.
not looking for the answer here, Looking for the way to solve it. explain it to me like I'm 5 and speek baad eenglis abd break it down to the extremely very core cause I skipped loadsa math classes and I'm very old and starting to regret my life's decisions.
alrighty.. I've found the answer thanks to the awesome peoples below.. Thanks again everyone <33
also. the answer is:- divide each colours, and whichever have the lowest value, is the maximum amount of candy packets I would have.
Category All / Miscellaneous
Species Unspecified / Any
Size 1024 x 768px
File Size 213.2 kB
Listed in Folders
Check how many one-colored packets you could make and then pick the lowest number? That seems reasonable to me but I don't know anything and nobody should ever listen to me (unless I'm correct and I know it, then I'd hate you for not listening and I'd be all like "But I tooold you so")
If each packet MUST contain the amount on top, then you have to stop as soon as you run out of enough of one color to fill the packets.
The one that would run out first is green after two packets.
There are more specific formulas for this, but it's also just a matter of dividing each of the bottom numbers by the top numbers and then rounding all three results DOWN to the closest whole number and choosing the lowest number as your answer.
The one that would run out first is green after two packets.
There are more specific formulas for this, but it's also just a matter of dividing each of the bottom numbers by the top numbers and then rounding all three results DOWN to the closest whole number and choosing the lowest number as your answer.
The way I'd do this in code form would be to check all three colours. So how many packets could I make if I only consider red candies, how many only considering blue candies and how many considering green candies. So do the 12/3, 7/2, 11/4. Then I check which of these is the lowest number with a simple block of if statements. So If(red>blue) then (If(blue>green)then green else blue) else (If(red>green) then green else red).
Ooooh, ive not seen these problems in a while. It's limiting factor sets... xD just solve as everyone's already mentioned and ypure golden. sometimes it's a multi-step.process like...
"Each bagof candies is made of three red and five hundred blues. Each case is made of.five bags of candy. If you have sixty reds and 3000 blues, how many cases can you make?"
"Each bagof candies is made of three red and five hundred blues. Each case is made of.five bags of candy. If you have sixty reds and 3000 blues, how many cases can you make?"
... math = bane of all existence
but... this is simple (In my eyes) I have not clue what the real answer is, or whether this is correct but:
so if each MUST contain their respective numbers, you look at each one, and pull out part of one set. The one with the least amount you can pull out is the MAX amount of sets you can make, in this case, you can only pull 2 sets out of the greens, 11/4 ~ 2. there for, you can only make 2 sets, and have a partial one left over, with remaining blue and red.
but... this is simple (In my eyes) I have not clue what the real answer is, or whether this is correct but:
so if each MUST contain their respective numbers, you look at each one, and pull out part of one set. The one with the least amount you can pull out is the MAX amount of sets you can make, in this case, you can only pull 2 sets out of the greens, 11/4 ~ 2. there for, you can only make 2 sets, and have a partial one left over, with remaining blue and red.
probably a simple value check, if you have the luxury of it, you can just do the check against it each time a single trade happens, until it no longer can, which would stop at 2 in this case. for an 'all in one go' coding, you could teach the code to handle it as a value in base 2, base3, or base4. and then have it check against the 'tens' value.
Comments