Problem 52839. Easy Sequences 33: Web Trapped Ant
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…
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 CommentsShow comments
Problem Recent Solvers9
Arrange Vector in descending order
Given a window, how many subsets of a vector sum positive
More from this Author116
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!