题目传送门

/*
题意:给三个点求它们的外接圆,判断一个点是否在园内
计算几何:我用重心当圆心竟然AC了,数据真水:)
正解以后补充,http://www.cnblogs.com/kuangbin/archive/2013/09/11/3315055.html
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
using namespace std; int main(void) //HDOJ 4720 Naive and Silly Muggles
{
//freopen ("E.in", "r", stdin); double x1, y1, x2, y2, x3, y3, xq, yq;
double x0, y0;
double r;
double d;
int t, cas = ; scanf ("%d", &t);
while (t--)
{
scanf ("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
scanf ("%lf%lf", &xq, &yq);
x0 = (x1 + x2 + x3) / 3.0;
y0 = (y1 + y2 + y3) / 3.0;
r = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);
d = (xq - x0) * (xq - x0) + (yq - y0) * (yq - y0); printf ("Case #%d: ", ++cas);
if (d <= r) puts ("Danger");
else puts ("Safe");
} return ;
} /*
Case #1: Danger
Case #2: Safe
Case #3: Safe
*/

最新文章

  1. Microsoft Visual Studio 文件识别及其用途简述
  2. ASP.Net中的Web Resource
  3. 最新中国菜刀caidao-20160620下载和说明
  4. jQuery 遍历同胞(siblings)
  5. [转载] 与WIN不同,linux替换文件夹会删除原文件夹下的全部内容!
  6. Linux学习awk命令
  7. js原型二
  8. 图解 CMS 垃圾回收机制原理,-阿里面试题
  9. jsonp简介
  10. 解决Mysql命令行输入密码闪退问题
  11. c# 后台绑定treeview 多个tab
  12. jquery父、子、兄弟节点查找
  13. MODIS 数据产品预处理
  14. Zigbee学习
  15. IDEA中Maven切换国内源
  16. android studio新建项目时出现Error:Execution failed for task &#39;:app:preDebugAndroidTestBuild&#39;.
  17. stateless 无状态组件
  18. Spring Framework 官方文档学习(一)介绍
  19. CENTOS7 YUM安装BOOST1.53(静态版本)
  20. [转载]uml 类图依赖与关联的区别

热门文章

  1. zhx&#39;s contest (矩阵快速幂 + 数学推论)
  2. Unity3D如何制作透贴和使用透贴模型
  3. [OpenJudge 3064]坠落的蚂蚁
  4. poj2632 模拟
  5. PHP表单验证
  6. petri网学习心得
  7. BASH相关
  8. ARM 处理器的几个相关术语
  9. excel复制+粘贴,怎样让公式里的参数不自动变化?
  10. JavaScript设计模式 - 迭代器模式