标签:
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1207 Accepted Submission(s): 367
1 /************************************************************************* 2 > File Name: code/2015summer/#6/II.cpp 3 > Author: 111qqz 4 > Email: rkz2013@126.com 5 > Created Time: 2015年08月01日 星期六 03时09分18秒 6 ************************************************************************/ 7 8 #include<iostream> 9 #include<iomanip> 10 #include<cstdio> 11 #include<algorithm> 12 #include<cmath> 13 #include<cstring> 14 #include<string> 15 #include<map> 16 #include<set> 17 #include<queue> 18 #include<vector> 19 #include<stack> 20 #define y0 abc111qqz 21 #define y1 hust111qqz 22 #define yn hez111qqz 23 #define j1 cute111qqz 24 #define tm crazy111qqz 25 #define lr dying111qqz 26 using namespace std; 27 #define REP(i, n) for (int i=0;i<int(n);++i) 28 typedef long long LL; 29 typedef unsigned long long ULL; 30 const int inf = 0x7fffffff; 31 32 33 LL dis(LL x1,LL x2,LL y1,LL y2,LL z1,LL z2) 34 { 35 36 return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2); 37 38 } 39 int main() 40 { 41 int T; //整体算法是寻找距离球最近的点,比较这个点到球心的距离和半径 42 // 。。。判断了边+点+面还没A的我好傻逼啊。。。。。。。。sad 43 // 卧槽,读错题了,长方体是实心的啊喂!怪不得我想的那么麻烦! 44 cin>>T; 45 while (T--) 46 { 47 LL tx,ty,tz; 48 LL x1 = inf; 49 LL x2 = -inf; 50 LL y1 = inf; 51 LL y2 = -inf; 52 LL z1 = inf; 53 LL z2 = -inf; 54 for ( int i = 1 ; i <= 8 ; i++ ) 55 { 56 57 scanf("%lld %lld %lld",&tx,&ty,&tz); 58 x1 = min(tx,x1); 59 x2 = max(tx,x2); 60 y1 = min(ty,y1); 61 y2 = max(ty,y2); 62 z1 = min(tz,z1); 63 z2 = max(tz,z2); 64 } 65 LL bx,by,bz,r; 66 LL x,y,z; 67 scanf("%lld %lld %lld %lld",&bx,&by,&bz,&r); 68 x = bx; 69 y = by; 70 z = bz; 71 if (x>x2) x=x2; 72 if (x<x1) x=x1; 73 if (y>y2) y=y2; 74 if (y<y1) y=y1; 75 if (z>z2) z=z2; 76 if (z<z1) z=z1; 77 if (r*r>=dis(x,bx,y,by,z,bz)) 78 { 79 puts("Yes"); 80 } 81 else 82 { 83 puts("No"); 84 } 85 86 87 } 88 89 return 0; 90 }
标签:
原文地址:http://www.cnblogs.com/111qqz/p/4693545.html