# zoj2318 getout（计算几何）

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1318

## tip：

#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn = 340;
const double eps = 1e-8;
bool inq[maxn];
struct Tcircle{
double x,y,r;
}p[maxn];
double dis[maxn];
struct node{
int u,v,next;
double w;
}edges[maxn*maxn];
}
void init(){
scanf("%d",&n);
for(int i = 1 ;i <= n ; i++){
scanf("%lf%lf%lf",&p[i].x,&p[i].y,&p[i].r);
}
scanf("%lf%lf%lf",&p[0].x,&p[0].y,&p[0].r);
for(int i = 1; i <= n ; i++)
p[i].r += p[0].r;
}
double dist(int i,int j){
return sqrt( (p[i].x-p[j].x)*(p[i].x-p[j].x)+(p[i].y-p[j].y)*(p[i].y-p[j].y) );
}
bool spfa(){
queue<int>q;
for(int i = 1;i <= n;i++){
q.push(i);
inq[i] = true;
num[i] = 0;
dis[i] = 0.0;
}
while(!q.empty()){
int tmp = q.front();q.pop();
inq[tmp] = 0;
for(int k = head[tmp];k != -1;k = edges[k].next){
if(dis[edges[k].v] > eps+dis[tmp]+edges[k].w){
dis[edges[k].v] = dis[tmp]+edges[k].w;
if(!inq[edges[k].v]){
inq[edges[k].v] = true;
q.push(edges[k].v);
num[edges[k].v]++;
if(num[edges[k].v] > n-1)       return true;
}
}
}
}
return false;
}
void sov(){
for(int i = 1; i <= n ; i++){
for(int j = i+1 ; j <= n ; j++){
if(p[i].r+p[j].r-dist(i,j) <= eps)   continue;
double ang = ( (p[i].x-p[0].x)*(p[j].x-p[0].x) + (p[i].y-p[0].y)*(p[j].y-p[0].y) )/dist(0,i)/dist(0,j);
ang = acos(ang);
if( (p[i].x-p[0].x) *(p[j].y-p[0].y) - (p[j].x-p[0].x) * (p[i].y-p[0].y) >= 0){
}
else{
}
}
}
}
int main(){
int T;
scanf("%d",&T);
while(T--){
init();
sov();
if(spfa())  printf("NO\n");
else    printf("YES\n");
if(T)   printf("\n");
}
}