On Oct 26, 12:56 pm, eSKay <[email protected]> wrote:
> This is one of the old puzzles, but I couldn't reason out how ppl get
> to the answer they say.
>
> "An ant has to crawl from one corner of a room to the diametrically
> opposite corner as quickly as possible. If the dimensions of the room
> are 3 x 4 x 5, what distance does the ant cover?"
>
> I think the answer is min( ( sqrt(sqr a + sqr b) + c ), (sqrt(sqr b +
> sqr c) + a), (sqrt(sqr c + sqr a) + b))
>
> but some people say the answer is min( ( sqrt(a + b) + c ), (sqrt(b +
> c) + a), (sqrt(c + a) + b)).
>
> How is that?
Mark the opposite corners, unfold the room and lay it flat
then draw a straight line between the corners and you wil
form a triangle with one of the walls as one side of the
triangle and the other two walls making the other side.
Which wall forms a side by itself depends on how you
unfold the box. For example:
dist=sqrt( (a+b)^2 + c^2 )
a b
+-----------------+-------+
| | /|
| | / |
| | / |
| | / |
| / |
| / | |
| / | | c
| / | |
| / | |
| / | |
| / | |
| / | |
| / | |
| / | |
+-----------------+-------+
--
Geoff
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---