标签:des style blog java color strong
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1561 Accepted Submission(s): 653
#include <iostream> #include <stdio.h> #include <math.h> #include <string.h> using namespace std; const double esp = 1e-10; struct Point{ double x,y,z; Point(double x = 0,double y = 0,double z = 0):x(x),y(y),z(z){} }; typedef Point Vector; Vector operator - (Vector A ,Vector B) {return Vector(A.x-B.x,A.y-B.y,A.z-B.z);} double Dot(Vector A ,Vector B) {return A.x*B.x+A.y*B.y+A.z*B.z;} double Length(Vector A) {return sqrt(Dot(A,A));} Vector Cross(Vector A,Vector B) {return Vector(A.y*B.z-A.z*B.y,A.x*B.z-A.z*B.x,A.x*B.y-A.y*B.x);} int main() { int t; double h1,h2,r1,r2,ans; Point a,b,c; scanf("%d",&t); while(t--) { scanf("%lf %lf %lf %lf %lf",&h1,&r1,&a.x,&a.y,&a.z); scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&h2,&r2,&b.x,&b.y,&b.z,&c.x,&c.y,&c.z); a.z+=h1-r1; b.z+=h2*0.9-r2; a = a-b; ans = Length(Cross(a,c))/Length(c); if(ans<=r1) printf("YES\n"); else printf("NO\n"); } return 0; }
标签:des style blog java color strong
原文地址:http://www.cnblogs.com/llei1573/p/3845293.html