ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
back to board

Discussion of Problem 1800. Murphy's Law

About the formula
Posted by Nguyen Nguyen 18 Dec 2011 02:21
I think when the toast rotates an angle of w after t seconds, it will land if only the distance it traveled ( 0.5 * 981 * t * t ) plus its projection on the orthogonal ( 0.5 * l * |sin(w)| ) equals to h.

But I got WA when implementing this approach, then change the latter expression into l/2 and got AC. Could anyone explain this?

Edited by author 18.12.2011 02:22
Re: About the formula
Posted by HellKitsune 7 May 2012 22:43
l/2 works because when the middle of given toast is l/2 cm away from the ground, it won't change sides anymore.
Projection approach would work too, but it's tricky to implement. Binary and ternary searches won't work because distance + projection is neither monotonous nor unimodal (think about case when h is small and the toast is spinning very fast).