wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> microsoft >> 3 VEnding Machines
(Message started by: Moonz on Aug 7th, 2003, 8:06am)

Title: 3 VEnding Machines
Post by Moonz on Aug 7th, 2003, 8:06am
Was asked this in an interview at MS this week

3 Vending Machines painted BLACK. 3 LABELS : COKE, SPRITE, COKE+SPRITE. ALL machines are labelled incorrect. One can is for a quarter. How many quarters do you need to find the correct labels for each machine ?? I figured out the answer but just for FYI sakes  , This forum helped me a lot !! so trying to repay back ... :)

Title: Re: 3 Vending Machines
Post by wowbagger on Aug 7th, 2003, 8:21am
Depends on how many quarters you have to feed the machines with to get something out of them... ;)

Anyway, this is along the same lines as Apples and Oranges (http://www.ocf.berkeley.edu/~wwu/riddles/easy.shtml#applesAndOranges), only with less information to start with.

Title: Re: 3 VEnding Machines
Post by Icarus on Aug 7th, 2003, 6:19pm
It could take lots. You, after reading the A&O thread, smugly put your quarter in to the "C+S" machine, knowing that if it gives you a Coke, it must be the Coke machine, the "Sprite" machine must really be the C+S machine, and the "Coke" machine would be the Sprite machine. And vice versa, if it gives a sprite. But your whole theory is shot to hell when that Pepsi drops out! :o

Title: Re: 3 VEnding Machines
Post by James Fingas on Aug 8th, 2003, 7:13am
None. Just label them all "Assorted".

Alternately:

None. Open up the machines, and label them according to what's inside them.

Or:

None. Just pull the plugs out of their sockets, cut the plugs off the cords, and label the machines "Out of Order".

Title: Re: 3 VEnding Machines
Post by otter on Aug 8th, 2003, 12:10pm
Alternately:
None.  Ignore the three machines and look for one that sells Dr. Pepper.

Title: Re: 3 VEnding Machines
Post by somu on Aug 12th, 2003, 6:31am
Only one check is enough to do the job  :)

say three levels are C, S and CS.
take one from C. surely it won't be C. If its S then S-m/c will have obviously CS ( otherwise third machine will be perfect)
and CS m/c will have C.
...
am I right boss ?

Title: Re: 3 VEnding Machines
Post by James Fingas on Aug 12th, 2003, 10:00am
somu,

Not quite. If you take one from C, it could be a C, because C might contain CS.

Title: Re: 3 VEnding Machines
Post by mistysakura on Aug 12th, 2003, 11:08pm
somu, if you get an S, there are at least two cases:
"coke"=Sprite "sprite-coke"=coke "sprite"=sprite-coke
or
"coke"=sprite-coke "sprite-coke"=sprite "sprite"=coke

Now what?

Title: Re: 3 VEnding Machines
Post by somu on Aug 13th, 2003, 6:40am
IF C is coming out of C means that is obviously CS. So CS labeled one will be S only (Otherwise S machine will be perfect) And 3rd one is C :) ... same way

Title: Re: 3 VEnding Machines
Post by Icarus on Aug 13th, 2003, 6:59pm
But if S comes out of C, it could be that
"C" = S, "S" = C+S, "C+S" = C,
or
"C" = C+S, "S" = "C", "C+S" = C.

Putting a coin in the "C" machine is not the way to go, even if this problem were changed to be equivalent the Apples and Oranges one.

As the problem is stated however, its just as possible that a coin in each machine would yield:
"C" => Dr. Pepper
"S" => Grape Nehi
"C+S" => Barq's

Title: Re: 3 VEnding Machines
Post by somu on Aug 14th, 2003, 2:42am
Hmm ...
    Better to put coin in CS machine only ... then hopefully we can come to the conclusion after one trial only .

If (CS -> C)
    CS =C,C=S,S=CS
else
    CS=S,S=C,C=CS

  Is that fine !!

Title: Re: 3 VEnding Machines
Post by grimbal on Apr 30th, 2004, 4:08pm
You need 3 quarters.

If the label is wrong, you have no idea what the hell these machines are selling.  I have never seen a Coke machine painted black.  Just get one item from each and glue it on the front of the machine.  Maybe a sandwich, a coffee and a pack of condoms.

Title: Re: 3 VEnding Machines
Post by megadeth on Oct 6th, 2004, 11:21am
my first post here...so go easy one me..
u'll need 1 quarter.

put it in  C+S

if C+S ->C then S->C+S and C->S
or
if C+S ->S then S->C and C->C+S
;D

Title: Re: 3 VEnding Machines
Post by Rejeev on Oct 11th, 2004, 9:09pm
You need one quarter.
get one can from S.
   If it contains C -> CS contains S (because, CS cannot contain CS and C is already at S). And C contains CS.
   If S contains CS -> C contains S and CS contains C
Important thing to note here is "all are incorrect"

Title: Re: 3 VEnding Machines
Post by Grimbal on Oct 12th, 2004, 10:05am
But if "S contains CS", you will get a C or an S.  If you get a C, you won't know whether it contains C or the C+S.

Title: Re: 3 VEnding Machines
Post by Icarus on Oct 12th, 2004, 5:28pm
And, as I have hinted at above, the way this puzzle is stated, they need not contain Coke or Sprite at all! Since all you know is that the labels are incorrect, the machines could dispence Moose Juice, Snapple, and Ocean Spray.

Title: Re: 3 VEnding Machines
Post by Rejeev on Oct 12th, 2004, 9:17pm

on 10/12/04 at 10:05:45, Grimbal wrote:
But if "S contains CS", you will get a C or an S.  If you get a C, you won't know whether it contains C or the C+S.

Coke + Sprite means Coke sprite mixture (some cocktail!!!) or coke OR Sprite?
Again as Icarus suggested, lebeled incorrect means just incorrect or only labels misplaced?

Title: Re: 3 VEnding Machines
Post by Grimbal on Oct 13th, 2004, 1:05am
The way I understand it, the labels have been misplaced an none of them is on its original machine, and the C+S machine contains both types of cans and gives one of them randomly.

When I said it could contain anything, a sandwich etc, I was intentionally misinterpreting the question.

Title: Re: 3 VEnding Machines
Post by Rejeev on Oct 13th, 2004, 1:14am

on 10/13/04 at 01:05:16, Grimbal wrote:
The way I understand it, the labels have been misplaced an none of them is on its original machine, and the C+S machine contains both types of cans and gives one of them randomly.

When I said it could contain anything, a sandwich etc, I was intentionally misinterpreting the question.

In this case also you need only one quarter.
First put one quarter into C+S machine
  if that gives C, then S is C+S and C is S
  if that gives S, then C is C+S and S is C
  (it cannot give C+S because it is labeled C+S)

Title: Re: 3 VEnding Machines
Post by Dave on May 25th, 2009, 10:20pm
You may not need any quarters!
Google "soda machine hacks" and you will find that there is a sequence of pushbutton presses that will show you what is in the machine (among other things!) ;D

Title: Re: 3 VEnding Machines
Post by chronodekar on Jun 24th, 2009, 2:38am
If in the question, "labels are incorrect" means that the original labels could be anything, then the rest of the statements in the question are pointless.

Intuitively, that means we can assume that the 3 labels have been switched around AND that none of them are on the machines that they correspond to.

Furthermore, at an interview, telling the questioner that Pepsi might come out, should, IMO, significantly reduce the chances of you being selected.

So, everything taken into account my answer is,
[hideb]1[/hideb]

for reasons mentioned in an earlier post.

-chronodekar

Title: Re: 3 VEnding Machines
Post by cynder on May 28th, 2010, 7:04pm

on 04/30/04 at 16:08:23, grimbal wrote:
You need 3 quarters.

If the label is wrong, you have no idea what the hell these machines are selling.  I have never seen a Coke machine painted black.  Just get one item from each and glue it on the front of the machine.  Maybe a sandwich, a coffee and a pack of condoms.



In this misinterpertation you would need an infinite amount of quarters actually. Since a machine could be selling coffee+ sandwhich+ condoms+ ........ etc.

Id rather go for [hideb]1[/hideb].

On a serious note, would interviewers appreciate you pointing out an ill-defined question? Or would they rather have you just awnser it as it was obviously intended.

Did anyone have experience with this?



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