#include<stdio.h> #include<math.h> struct point { double x; double y; }circle,a,b,c,d,temp; double r; double dis(point &a,point &b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } int main() { int s,t; scanf("%d",&s); while(s--) { scanf("%lf%lf%lf",&circle.x,&circle.y,&r); scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a.x,&a.y,&b.x,&b.y,&c.x,&c.y,&d.x,&d.y); if(a.x > c.x) { temp=a; a=c; c=temp; } if(dis(a,circle)<r && dis(b,circle)<r && dis(c,circle)<r && dis(d,circle)<r) { printf("No!\n"); continue; } if(circle.x >= a.x && circle.x <= c.x) { if(fabs(circle.y - a.y) <= r || fabs(circle.y - c.y) <= r) { printf("Yes!\n"); continue; } } if((circle.y >= a.y && circle.y <= b.y) || (circle.y >= b.y && circle.y <= a.y)) { if(fabs(circle.x - a.x) <= r || fabs(circle.x - c.x) <= r) { printf("Yes!\n"); continue; } } if(dis(a,circle)<=r || dis(b,circle)<=r || dis(c,circle)<=r || dis(d,circle)<=r) { printf("Yes!\n"); continue; } printf("No!\n"); } return 0; }http://blog.csdn.net/sunrain_chy/article/details/9492801
时间: 2024-10-31 18:26:27