Union time limit:MS | Memory limit:65535 KB Difficulty:1
-
Describe
-
Welcome to the Union of De Lai ....
De Levin ...
De Levin is running away, Kazik is chasing ...
We know the start and end coordinates of the Kazik, and we also know the starting and midpoint coordinates of the Kazik, Q: Is it possible to meet with Ryder? , and make sure they are going straight.
-
-
Input
-
-
several sets of data, an integer t representing the T-group data
8 real numbers per set of data representing the start and end coordinates of the Kazik, and the start and end coordinates of the
-
-
Output
-
-
If output interseetion is possible, the output is not interseetion
-
-
Sample input
-
-
2-19.74 7.14 22.23-27.45-38.79-5.08 47.51 34.01-8.61 9.91-32.47 6.47-3.81-16.1 7.82-6.37
-
-
Sample output
-
-
Interseetionnot interseetion
Code
Package Acmjihe;import Java.util.scanner;public class Main1 {public static void main (string[] args) {Scanner input = new S Canner (system.in); int n = Input.nextint (); for (int i = 0; i < n; i++) {Double A = input.nextdouble ();d ouble B = INPUT.N Extdouble ();d ouble C = input.nextdouble ();d ouble d = input.nextdouble ();d ouble e = input.nextdouble ();d ouble f = Input.nex Tdouble ();d ouble g = input.nextdouble ();d ouble h = input.nextdouble ();d ouble x1 = (e-a) * (d-b)-(f-b) * (c-a);d o Uble x2 = (g-a) * (d-b)-(h-b) * (c-a);d ouble y1 = (a-e) * (h-f)-(b-f) * (g-e);d ouble y2 = (c-e) * (h -f)-(d-f) * (G-E), if ((x1 * X2 < 0) && (y1 * y2 < 0)) {System.out.printf ("interseetion\n");} else {S ystem.out.printf ("not interseetion\n");}}}
The Union of the De Lai