ZOJ Problem Set - 4041
In a Descartes coordinate system, areas where $x \ge 0$ belongs to Shinnippori, while areas where $x < 0$ belongs to Nippori.
Van, now located at point $A$ whose position is $(x_A, y_A)$, is found by Billy whose location is point $B$, more specifically $(x_B, y_B)$. It is guaranteed that $A$ and $B$ are both in Nippori, in another word, $x_A, x_B < 0$.
Van is afraid of having another wrestle with Billy, so he is trying his best to run to Shinnippori. However, Billy wants to catch him. It is known that Billy's speed is $k$ times of Van's. Please answer, if Billy and Van both take the best strategy, whether Billy is always able to catch Van in Nippori.
One thing to be mentioned is that Van cannot choose to stay in Nippori forever.
There are multiple test cases. The first line of the input contains an integer $T$ ($1 \le T \le 1000$), indicating the number of cases.
For the following $T$ lines, each line contains five real numbers $x_A$, $y_A$, $x_B$, $y_B$, $k$ ($-10000 \le x_A, x_B < 0$, $-10000 < y_A, y_B < 10000$, $0 < k < 100$), whose meanings are stated above.
For each test case output one line. If Billy is always able to catch Van in Nippori (in another word, Van never has a chance to run into Shinnippori before getting caught) output "Y" (without quotes); Otherwise output "N" (without quotes).
3 -2 3 -1 2 0.988 -4 -3 -6 8 4 -10 4 -5 4 2.3333
N Y Y
For the first sample case, if Van run along the line which is perpendicular to $AB$, Billy can never catch him.
Author: WANG, Yuhan
Source: ZOJ Monthly, June 2018