51nod1265 Four points common face

Source: Internet
Author: User

Topic Link: 51nod 12,654-point Coplanar

The necessary and sufficient condition of the three vector a,b,c Coplanar is that there are not all zeros of the real number x, Y, Z meet X*a+y*b+z*c=0, and then think of the line generation.

In fact, the three-vector mixed product is 0: (a,b,c) = (AXB) c=

|ax ay az|

|BX by bz| = Ax*by*cz+ay*bz*cx+bx*cy*az-az*by*cx-ay*bx*cz-ax*bz*cy = 0;

|CX Cy Cz|

When I saw the determinant, I thought of the linear algebra test, but I didn't preview it ~ ~ ~ (>_<) ~ ~ ~

1#include <cstdio>2#include <cstring>3#include <algorithm>4 using namespacestd;5 structpoint{6     intx, y, z7}p[3];8 intMain () {9     intT, I, K;Ten     intx, y, z One     intAx,ay,az,bx,by,bz,cx,cy,cz; Ascanf"%d", &t); -      for(k =1; K <= T; ++k) { -scanf"%d%d%d",&x,&y,&z); the          for(i =0; I <3; ++i) -scanf"%d%d%d",&p[i].x,&p[i].y,&p[i].z); -ax=p[0].x-x; ay=p[0].y-y; az=p[0].z-Z; -bx=p[1].x-x; by=p[1].y-y; bz=p[1].z-Z; +cx=p[2].x-x; cy=p[2].y-y; cz=p[2].z-Z; -         if(Ax*by*cz+ay*bz*cx+bx*cy*az-az*by*cx-ay*bx*cz-ax*bz*cy = =0) +Puts"Yes"); A         ElsePuts"No"); at     } -     return 0; -}
View Code

51nod1265 Four points common face

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.