2430. Intersecting Lines

单点时限: 2.0 sec

内存限制: 256 MB

Your task is to calculate the intersection of given two lines.

输入格式

Input will consist of $N$ $(0< N< 40)$ test cases. Each test case consists of eight integers. These integers represent the coordinates of four points on the plane in the order $x_1,y_1,x_2,y_2,x_3,y_3,x_4,y_4$. Thus each of these input lines represents two lines on the plane: the line through $(x_1,y_1)$ and $(x_2,y_2)$ and the line through $(x_3,y_3)$ and $(x_4,y_4)$. The point $(x_1,y_1)$ is always distinct from $(x_2,y_2)$. Likewise with $(x_3,y_3)$ and $(x_4,y_4)$. Input terminated by EOF.

All inputs have absolute values less than $10~000$.

You can assume that all inputs are valid and can calculate the multiplication.

输出格式

Your program should output the $x$ and $y$ coordinates of the intersecting point, correct to two dicimal places like shown below if exists only one intersection, othewise print NONE. Do not output extra spaces or new lines.

样例

Input
5
0 0 4 4 0 4 4 0
5 0 7 6 1 0 2 3
5 0 7 6 3 -6 4 -3
2 0 2 27 1 5 18 5
0 3 4 0 1 2 2 5
Output
2.00 2.00
NONE
NONE
2.00 5.00
1.07 2.20

22 人解决,49 人已尝试。

26 份提交通过,共有 132 份提交。

6.2 EMB 奖励。

创建: 15 年,4 月前.

修改: 6 年,6 月前.

最后提交: 3 年,5 月前.

来源: ECNU 选拔 2008

题目标签