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?
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).