wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> medium >> Vending machine problem.
(Message started by: sateesp on Feb 27th, 2010, 1:18am)

Title: Vending machine problem.
Post by sateesp on Feb 27th, 2010, 1:18am
There is a one milk vending machine, which has three buttons. Each button has limits called min and max. These limits indicates that when you press that button , min and max milk that you can get. Given this information, how would you find, is it possible to get the milk in the range of given min and max by pressing any combination of vending machine 3 buttons.

Title: Re: Vending machine problem.
Post by R on Mar 5th, 2010, 9:00pm
Can anyone explain clearly on what is being asked and what is given?

Title: Re: Vending machine problem.
Post by towr on Mar 6th, 2010, 3:37am
If I had to guess, I'd say we are given intervals [a,b], [c,d], [e,f], and want to add them together in some way such that the resultant interval you get lies in [g,h].
So we want to find x,y,z such that xa+yc+ze >=g and xb+yd+zf <=h

Title: Re: Vending machine problem.
Post by Ant_Man on Mar 8th, 2010, 2:21pm
I believe we just need g<=xa+yc+ze<=h or g<=xb+yd+zf<=h. He just wants to know if it is possible at all.

It seems like the best strategy could potentially change after each button press, too.

Title: Re: Vending machine problem.
Post by sateesp on Mar 17th, 2010, 10:01am
That would be a brute force technique. Is there any better way to solve this ?

Title: Re: Vending machine problem.
Post by towr on Mar 17th, 2010, 11:46am
Let's first settle on what problem you want to solve. Is Ant_Man's interpretation correct, or mine?

Title: Re: Vending machine problem.
Post by sateesp on Mar 20th, 2010, 10:25pm
Ant_Man's interpretation correct. we just need  find the x,y, z such that it  satisfies the following condition.
g<=xa+yc+ze<=h or g<=xb+yd+zf<=h.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board