12,654 points common face
Base time limit: 1 seconds space limit: 131072 KB gives the four points on the three-dimensional space (the point and the location of the point are not the same), to determine whether the 4 points in the same plane (4 points collinear also counted coplanar). If the coplanar, output "Yes", otherwise output "No". Input
Line 1th: A number T, indicating the number of tests entered (1 <= t <= 1000) 第2-4 T + 1 lines: 4 rows per line represents a set of data, 3 numbers per row, x, Y, Z, indicating the location coordinates of the point ( -1000 <= x, y, z <= 1000).
Output
Outputs a total of t lines, or outputs "No" if the coplanar output is "Yes".
Input example
11 2 02 3 04 0 00 0 0
Output example
Yes
Idea: can be composed of 4 points to form 3 vectors, 3 vector coplanar is the necessary and sufficient condition is a vector of a, B, C, the existence of real numbers x, Y, Z is not all zero, is xa+yb+zc=0, converted to linear algebra of 3 vectors linearly related to the number of rows is 0.
#include <cstdio>#include<cstring>intMain () {intT; Doublex[4], y[4], z[4]; scanf ("%d", &t); while(t--) { for(intI=0; i<4; i++) {scanf ("%LF%LF%LF", &x[i], &y[i], &Z[i]); } DoubleS11, S12, S13, S21, S22, S23, S31, S32, S33; S11= x[1]-x[0]; S12= y[1]-y[0]; s13= z[1]-z[0]; S21= x[2]-x[1]; S22= y[2]-y[1]; s23= z[2]-z[1]; S31= x[3]-x[2]; S32= y[3]-y[2]; s33= z[3]-z[2]; if(s11*s22*s33+s12*s23*s31+ s21*s32*s13-s13*s22*s31-s12*s21*s33-s23*s32*s11==0) puts ("Yes"); Elseputs ("No"); } return 0;}
12,654 points common face