# HDU 1174 爆頭 幾何

Problem Description
gameboy是一個CS高手，他最喜歡的就是扮演警察，手持M4爆土匪的頭。也許這裡有人沒玩過CS，有必要介紹一下“爆頭”這個術語：所謂爆頭，就是子彈直接命中對方的頭部，以秒殺敵人。

Input

Output

Sample Input
2
1.62 0.1 10.0 10.0 10.0
1.80 0.09 0.0 0.0 0.0 1.0 1.0 1.0
1.62 0.1 0.0 0.0 0.0
1.80 0.09 10.0 10.0 10.0 -1.0 -1.0 -1.0
Sample Output
YES
YES
Author
lwg
|AB與AC的叉積| 除 |AC|  = 點B到直線AC的距離

``````#include<iostream>
using namespace std;
#include<stdio.h>
#include<math.h>
typedef   double kind;
typedef struct
{
kind x,y,z;
} Point;
struct p
{
kind h,r,x,y,z;
kind _x,_y,_z;
} police;
struct r
{
kind h,r,x,y,z;
} robber;
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
scanf("%lf%lf%lf%lf%lf",&robber.h,&robber.r,&robber.x,&robber.y,&robber.z);
scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&police.h,&police.r,&police.x,&police.y,&police.z,&police._x,&police._y,&police._z);
Point       p_r;
p_r.x=robber.x-police.x, p_r.y=robber.y-police.y ,p_r.z=robber.z robber.h-robber.r-(police.z police.h*0.9-police.r);
Point      chaji;
chaji.x= p_r.x*police._y- p_r.y*police._x  ,  chaji.y=p_r.y*police._z- p_r.z*police._y ,   chaji.z= p_r.z*police._x - p_       r.x*police._z;
kind lABXACl=sqrt(chaji.x*chaji.x   chaji.y*chaji.y  chaji.z*chaji.z);
kind AC=sqrt(police._x*police._x  police._y*police._y  police._z*police._z);
lABXACl/AC<=robber.r? printf("YES\n"): printf("NO\n");
}
}
``````