1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| #include<stdio.h> #include<set> #include<iostream> #include<algorithm> #include<cmath> #include<cstring> #define mem(ss) memset(ss,0,sizeof(ss)) #define rep(d, s, t) for(int d=s;d<=t;d++) #define rev(d, s, t) for(int d=s;d>=t;d--) typedef long long ll; typedef long double ld; typedef double db; const ll mod = 1e9+7; const int N = 1e4 + 10; #define io_opt ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) const int INF = 1e8; using namespace std; struct Vector{ int x,y,z; Vector(){ x=0,y=0,z=0; }; }; struct Point{ int x,y,z; Point(){ x=0,y=0,z=0; } void Input(){ cin>>x>>y>>z; } }; Vector cromul(Vector a1,Vector a2){ Vector tmp; tmp.x=a1.y*a2.z-a1.z*a2.y; tmp.y=a1.z*a2.x-a1.x*a2.z; tmp.z=a1.x*a2.y-a1.y*a2.x; return tmp; } Vector ptv(Point a1,Point a2){ Vector tmp; tmp.x=a2.x-a1.x; tmp.y=a2.y-a1.y; tmp.z=a2.z-a1.z; return tmp; } int pmul(Vector a1,Vector a2){ return a1.x*a2.x+a1.y*a2.y+a1.z*a2.z; } Point p[6]; Vector v[10]; int T; int main() { io_opt; cin>>T; while(T--){ for(int i=1;i<=4;i++){ p[i].Input(); } v[1]=ptv(p[1],p[2]); v[2]=ptv(p[1],p[3]); v[3]=ptv(p[1],p[4]); v[4]=cromul(v[1],v[2]); if(pmul(v[3],v[4])==0){ cout<<"Yes\n"; } else{ cout<<"No\n"; } } return 0; }
|