#P1426. Fish and Hunter: Will the Fish be Caught?

    ID: 14712 Type: Default 1000ms 256MiB

Fish and Hunter: Will the Fish be Caught?

Fish and Hunter: Will the Fish be Caught?

A fish starts swimming from point A along a straight line to the right. In the first second, it swims 77 meters. From the second second onward, in each second it swims only 98%98\% of the distance it swam in the previous second. That is, if the distance in the first second is d1=7d_1=7, then for every subsequent second i2i\ge2 the distance is [ d_i = 0.98\times d_{i-1}, ] and the cumulative distance after nn seconds is [ T_n = 7\cdot\frac{1-0.98^n}{1-0.98} = 350\left(1-0.98^n\right). ]

A devious hunter has installed a hidden detector at a point ss meters to the right of A. The detector monitors a region extending xx meters to its left and right, i.e. the detection zone is the interval [ [s-x,; s+x]. ] If the fish enters this range at any moment during a second, the detector will send a signal at the end of that second. One second after the signal is sent the hunter will attempt to catch the fish if it is still within the detector zone. In other words, once the fish enters the detector zone, if it cannot completely exit the zone within the next one second, it will be caught.

Given the values of ss and xx, determine whether the fish is in danger. Output a single character: output y if the fish is in danger, and n if it is safe.

Note: The fish moves continuously with uniform speed in each second. The moment it crosses into the detector zone (if it does) during a second is considered as triggering the detector at the end of that second. Then the fish gets exactly one more second to exit the detector zone before the hunter catches it.

inputFormat

The input consists of two space-separated numbers: ss and xx, where ss (in meters) is the position of the detector and xx (in meters) is the half-length of the detector's range.

outputFormat

Output a single character: y if the fish is in danger, or n if the fish is safe.

sample

100 5
y