Re: A Teaser Solving Program
- Posted by Jason Gade <jaygade at yahoo.??m> Oct 08, 2007
- 591 views
Tristen Wilson wrote: > > > What is it that you would want the program to do? Point out the flaw in > > the text? This is an old "brain teaser" that uses a false statement to > > confuse the listener. > > > > Assuming that you're really asking what the answer is, then it's that they > > didn't pay $27. They paid $25 for the room, and the clerk "split" the > > change with them. The hotel got $25, the clerk got $2, and they kept the > > other $3. > > > > Matt > I'm severely confused! I've been trying to figure out how to explain this problem. The error is pretty subtle and I had to look it up. I've seen the problem before but I had forgotten. This is my third attempt to explain it (I canceled the others). The room cost $25. The students paid $30. They were refunded $5. Of that $5, $2 went to the clerk. So the students paid $27 for the room. Of that $27, $25 went to the hotel and $2 went to the clerk. The $3 is a red herring and the extra $1 is a phantom. I don't know how to solve a basic mathematical error with a computer. $25 + $5 = $30 -- room charge plus overpayment equals total. $25 + $2 = $27 -- refund $3 to the students (subtract $3 from both sides) $25 = $25 -- give the clerk his $2 cut (subtract $2 from both sides) Less confused? Me neither. But that's why it's a puzzle. Basically the reverse of the problem is wrong -- the $2 shouldn't be added, it should be subtracted. $30 total - $3 to students - $2 to clerk = room cost ($25) whereas the problem says $30 total - $3 to students + $2 to clerk = room cost ($25). See the problem? -- A complex system that works is invariably found to have evolved from a simple system that works. --John Gall's 15th law of Systemantics. "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.