链接

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

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

 #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. socket的心跳包机制

    网络中的接收和发送数据都是使用操作系统中的SOCKET进行实现.但是如果此套接字已经断开,那发送数据和接收数据的时候就一定会有问题.可是如何判断这个套接字是否还可以使用呢?这个就需要在系统中创建心跳机 ...

  2. OS开发拓展篇—应用之间的跳转和数据传

    iOS开发拓展篇-应用之间的跳转和数据传 说明:本文介绍app如何打开另一个app,并且传递数据. 一.简单说明 新建两个应用,分别为应用A和应用B. 实现要求:在appA的页面中点击对应的按钮,能够 ...

  3. 【转】西门子数控系统中MMC、PCU、NCU、CCU简略介绍

    转载地址:http://cyj221.blog.163.com/blog/static/34194117201093005526170/ 2010-10-30 01:06:09|  分类: 机械制造 ...

  4. android 比较靠谱的图片压缩

    第一:我们先看下质量压缩方法: private Bitmap compressImage(Bitmap image) { ByteArrayOutputStream baos = new ByteAr ...

  5. jdk 与jre的区别

    jdk就是java的开发工具集,顾名思义就是你做开发用的,其中包括javac,也就是java compiler等. jre(java runtime environment),就是java程序的运行环 ...

  6. Andriod 按钮代码

    package com.example.test1; import android.support.v7.app.ActionBarActivity; import android.os.Bundle ...

  7. Animator根骨骼运动原始实现代码

    实测过确实可行,注意如果没有刚体组件,实现方式会不一样 public class TestSMB : StateMachineBehaviour { public override void OnSt ...

  8. 测试post

    http://www.atool.org/httptest.php 这里也可以测试 火狐有插件:HttpRequester Chrome有插件:Postman

  9. [Django_1_1]第一个app

    Django 第一个app 本篇负责介绍添加第一个Django app. 本篇文章的上一篇为:Django 初次见面 关于App和Project 简单的来说,一个项目(Project)可以由很多个应用 ...

  10. centOS6.5安装SUN-jdk7

    一.下载SUN-JDK1.7.tar.gz文件他 地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1 ...