标签:
题目链接:HDU - 5206
1 #include<iostream> 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cmath> 6 #include<algorithm> 7 #include<vector> 8 #include<queue> 9 #define inf 0x7fffffff 10 using namespace std; 11 typedef long long LL; 12 const LL maxn=10000+10; 13 14 LL n,m; 15 struct Point 16 { 17 LL x,y,z; 18 Point (LL x=0,LL y=0,LL z=0):x(x),y(y),z(z){} 19 }a,b,c,d; 20 typedef Point Vector; 21 22 double Dot(Vector A,Vector B) {return A.x*B.x + A.y*B.y; } 23 double Length(Vector A) {return sqrt(Dot(A,A)); } 24 double angle(Vector A,Vector B) {return acos(Dot(A,B)/Length(A)/Length(B)); } 25 26 LL dis(Point A,Point B) 27 { 28 LL xx=(A.x-B.x)*(A.x-B.x); 29 LL yy=(A.y-B.y)*(A.y-B.y); 30 LL zz=(A.z-B.z)*(A.z-B.z); 31 return xx+yy+zz; 32 } 33 34 int main() 35 { 36 int t,ncase=1; 37 scanf("%d",&t); 38 while (t--) 39 { 40 scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d", 41 &a.x,&a.y,&a.z,&b.x,&b.y,&b.z,&c.x,&c.y,&c.z,&d.x,&d.y,&d.z); 42 //scanf("%d%d%d%d%d%d%d%d%d%d%d%d",&x1,&y1,&z1,&x2,&y2,&z2,&x3,&y3,&z3,&x4,&y4,&z4); 43 int flag=0; 44 LL len,len2,len3; 45 len=dis(a,b) ;len2=dis(a,c) ;len3=dis(a,d) ; 46 if ((len==len2&&len3==len+len2)||(len==len3&&len2==len+len3)||(len2==len3&&len==len2+len3)) 47 flag++; 48 len=dis(b,a) ;len2=dis(b,c) ;len3=dis(b,d) ; 49 if ((len==len2&&len3==len+len2)||(len==len3&&len2==len+len3)||(len2==len3&&len==len2+len3)) 50 flag++; 51 len=dis(c,a) ;len2=dis(c,b) ;len3=dis(c,d) ; 52 if ((len==len2&&len3==len+len2)||(len==len3&&len2==len+len3)||(len2==len3&&len==len2+len3)) 53 flag++; 54 len=dis(d,a) ;len2=dis(d,b) ;len3=dis(d,c) ; 55 if ((len==len2&&len3==len+len2)||(len==len3&&len2==len+len3)||(len2==len3&&len==len2+len3)) 56 flag++; 57 if (flag==4) printf("Case #%d: Yes\n",ncase++); 58 else printf("Case #%d: No\n",ncase++); 59 } 60 return 0; 61 }
hdu 5206 Four Inages Strategy 计算几何
标签:
原文地址:http://www.cnblogs.com/huangxf/p/4438115.html