Problem 52839. Easy Sequences 33: Web Trapped Ant
- It is understood there can be 2 possible positions, given a single y-offset. In this exercise please consider only the position as drawn above. That means at the top view, the ant and the spidert shall only be within the first and third quadrant, respectively.
- The dotted lines is not the spider's path. They are used only to project the heights to the side.
Solution Stats
Problem Comments
-
5 Comments
My results are all different, although the formula gets the right result in all the simple cases like hs=H/2; ha=H/2; xs=0; xa=0; etc...
I’m checking my solution…
Hi William,
I updated the test suites. I made a mistake in using full diameter instead of the semicircle's diameter. I also added a clarification to ensure only one option is considered.,
With regards to your solution. I think that your algorithm will work only if both the ant and spider are in the same side. Please take note that the ant is inside and the spider is outside. Please try again. Thanks.
The dotted line doesn't show it, but presumably the spider has to go up, over the top edge of the can, and down again. Also it can presumably choose whether to go clockwise or counterclockwise.
Hi William, I've included one solution into the problem itself. I hope this clarifies everything. Of course the circumference will not change. But if you would not consider inside/outside, the insects will appear to be closer together, and you will be get shorter distance than the correct one.
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
Return the largest number that is adjacent to a zero
5349 Solvers
-
Extract leading non-zero digit
2139 Solvers
-
Find state names that end with the letter A
1178 Solvers
-
Getting the indices from a vector
9848 Solvers
-
Find a subset that divides the vector into equal halves
387 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!