Company: nielsen
Difficulty: easy
Counting Geeta's Log Jumps Geeta wants to cross a river that has no bridge. She finds some logs floating on the water and decides to cross by jumping from one log to the next. The logs are all very slippery, and someone has tied them together at their left ends so that they stay parallel. Only the right end of a log offers any grip, so Geeta always stands on a log's right end and always jumps to the right end of the next log. Because the logs have different lengths, their right ends are not lined up, and every jump therefore also carries her a certain distance sideways. Geeta can jump at most X sideways to her left and at most Y sideways to her right . Suppose she is standing on a log of length A and the next log has length B . If B > A the jump moves her B - A to her right, which she can make only when B - A <= Y . If B < A the jump moves her A - B to her left, which she can make only when A - B <= X . If B == A there is no sideways movement and the jump is always possible