链接

一直理解的最小覆盖圆就是外接圆。。原来还要分钝角和锐角。。。

钝角的话就为最长边的中点,对于这题分别枚举一下外接圆以及中点的圆,判一下是不是在园外。

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
#define N 100000
#define LL long long
#define INF 0xfffffff
const double eps = 1e-;
const double pi = acos(-1.0);
const double inf = ~0u>>;
struct Point
{
double x,y;
Point (double x=,double y =):x(x),y(y){}
}p[];
struct Circle
{
Point center;
double r;
};
typedef Point pointt;
pointt operator - (Point a,Point b)
{
return Point(a.x-b.x,a.y-b.y);
}
int dcmp(double x)
{
if(fabs(x)<eps) return ;
return x<?-:;
}
double dis(Point a)
{
return a.x*a.x+a.y*a.y;
}
double cross(Point a,Point b)
{
return a.x*b.y-a.y*b.x;
}
double area()
{
return fabs(cross(p[]-p[],p[]-p[]))/;
}
struct Circle Circumcircle()
{
Circle tmp;
double a,b,c,c1,c2;
double xa,ya,xb,yb,xc,yc;
a = sqrt(dis(p[]-p[]));
b = sqrt(dis(p[]-p[]));
c = sqrt(dis(p[]-p[]));
//¸ù¾Ýs = a*b*c/R/4£¬Çó°ë¾¶
tmp.r = (a*b*c)/(area()*4.0);
xa = p[].x;
ya = p[].y;
xb = p[].x;
yb = p[].y;
xc = p[].x;
yc = p[].y;
c1 = (dis(p[])-dis(p[]))/;
c2 = (dis(p[])-dis(p[]))/;
tmp.center.x = (c1*(ya-yc)-c2*(ya-yb))/((xa-xb)*(ya-yc)-(xa-xc)*(ya-yb));
tmp.center.y = (c1*(xa-xc)-c2*(xa-xb))/((ya-yb)*(xa-xc)-(ya-yc)*(xa-xb));
return tmp;
}
int main()
{
int t,i;
cin>>t;
int kk = ;
while(t--)
{
for(i = ;i <= ; i++)
scanf("%lf%lf",&p[i].x,&p[i].y);
Circle cc = Circumcircle();
Point pp;
scanf("%lf%lf",&pp.x,&pp.y);
double r = cc.r;
r*=r;
printf("Case #%d: ",++kk);
if(dis(pp-cc.center)>r)
{
puts("Safe");
continue;
}
r = dis(p[]-p[])/;
cc.center.x = (p[].x+p[].x)/;
cc.center.y = (p[].y+p[].y)/;
if(dcmp(dis(p[]-cc.center)-r)<=&&dcmp(dis(pp-cc.center)-r)>)
{
puts("Safe");
continue;
}
r = dis(p[]-p[])/;
cc.center.x = (p[].x+p[].x)/;
cc.center.y = (p[].y+p[].y)/;
if(dcmp(dis(p[]-cc.center)-r)<=&&dcmp(dis(pp-cc.center)-r)>)
{
puts("Safe");
continue;
}
r = dis(p[]-p[])/;
cc.center.x = (p[].x+p[].x)/;
cc.center.y = (p[].y+p[].y)/;
if(dcmp(dis(p[]-cc.center)-r)<=&&dcmp(dis(pp-cc.center)-r)>)
{
puts("Safe");
continue;
}
puts("Danger");
}
return ;
}

hdu4720Naive and Silly Muggles的更多相关文章

  1. 计算几何 HDOJ 4720 Naive and Silly Muggles

    题目传送门 /* 题意:给三个点求它们的外接圆,判断一个点是否在园内 计算几何:我用重心当圆心竟然AC了,数据真水:) 正解以后补充,http://www.cnblogs.com/kuangbin/a ...

  2. Naive and Silly Muggles

    Problem Description Three wizards are doing a experiment. To avoid from bothering, a special magic i ...

  3. Naive and Silly Muggles (计算几何)

    Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  4. HDU 4720 Naive and Silly Muggles (外切圆心)

    Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...

  5. HDU 4720Naive and Silly Muggles热身赛2 1005题(分锐角钝角三角形讨论)

    Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  6. Naive and Silly Muggles hdu4720

    Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  7. HDU 4720 Naive and Silly Muggles (简单计算几何)

    Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  8. HDUOJ-------Naive and Silly Muggles

    Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  9. ACM学习历程—HDU4720 Naive and Silly Muggles(计算几何)

    Description Three wizards are doing a experiment. To avoid from bothering, a special magic is set ar ...

随机推荐

  1. python 入门教程

    转载自:http://www.crifan.com/files/doc/docbook/python_beginner_tutorial/release/html/python_beginner_tu ...

  2. 【20160924】GOCVHelper MFC增强算法(3)

        //获得当前目录路径     static CString GetLocalPath(){         CString csCfgFilePath;         GetModuleFi ...

  3. 安装nginx python uwsgi环境 以及模拟测试

    uwsgi帮助文档: http://uwsgi-docs-cn.readthedocs.io/zh_CN/latest/WSGIquickstart.html http://uwsgi-docs.re ...

  4. Spring资源访问

    资源访问 1.Resource Jdk提供的访问资源的类并不能很好地满足各种底层的资源访问需求, 比如缺少从类路径或者web容器的上下文中获取资源的操作类. 鉴于此, Spring设计了一个Resou ...

  5. 利用Velocity结合Spring发email

    在spring中发mail是一件容易的事,如果利用Velocity做mail的模板来发送就更得心应手了. 首先,还是简单描述sping中的配置,发mail需要一个mail的engin: <bea ...

  6. [Python]如何使用HtmlTestRunner让自动化测试报告内容更丰富

    简述 使用selenium webdriver + Python做自动化测试,执行完成后要生成测试报告,Python我们使用的HTMLtestrunner 进行生成,但是默认提供的生成报告内容,并不能 ...

  7. hdu 3037 Saving Beans

    Saving Beans Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  8. linux网络基础--学习笔记

       

  9. 多态,虚拟方法,重写,接口,类库,委托,is,as运算符,泛型集合,万能变量

    多态:简而言之就是龙生九子,各有不同 有了继承,才有了多态 1.虚方法 virtual重写 override父类中的方法,在子类中并不适用,那么子类需要自主更改继承的方法或者是属性,那父类中加了vir ...

  10. #utf-8与gbk转换 #bytes 和str 的转换

    #!/user/bin/env python # -*- coding:utf-8 -*- temp = "连接" temp_unicode = temp.decode('utf- ...