I have a hollow rectangular cardboard box that is 12" square on each end and the four long sides are 24" each, so each side has dimensions 12" x 24". Inside the box is a hungry spider positioned dead center on a square end. A lazy fly is also positioned dead center on the opposite square end.
What is the minimum distance that the spider must walk on the surface of the box to reach the fly?
Why does this stump you? The shortest distance is a straight line connecting the two points. Any deviation away from the directions "straight down, directly across the floor, straight up the other side" inevitably makes the route longer. Hence the shortest distance is 36".
See attached pic; an "unfolded" floorplan showing the 8 ways in which the spider can travel in a straight line towards the fly.
Brain dead. Somehow I thought that walking on the diagonal path and thus using five of the six surfaces would be shorter than walking on only three.
Is there any way that the spider and fly could be positioned inside the box with the top open so that walking on all five of the available surfaces results in a shorter walk?
No. But the only vertical walking spiders do is on theinr webs or up. A spider never walks down.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana