计算几何 HDOJ 4720 Naive and Silly Muggles
2024-10-15 01:23:42
/*
题意:给三个点求它们的外接圆,判断一个点是否在园内
计算几何:我用重心当圆心竟然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
*/
最新文章
- Microsoft Visual Studio 文件识别及其用途简述
- ASP.Net中的Web Resource
- 最新中国菜刀caidao-20160620下载和说明
- jQuery 遍历同胞(siblings)
- [转载] 与WIN不同,linux替换文件夹会删除原文件夹下的全部内容!
- Linux学习awk命令
- js原型二
- 图解 CMS 垃圾回收机制原理,-阿里面试题
- jsonp简介
- 解决Mysql命令行输入密码闪退问题
- c# 后台绑定treeview 多个tab
- jquery父、子、兄弟节点查找
- MODIS 数据产品预处理
- Zigbee学习
- IDEA中Maven切换国内源
- android studio新建项目时出现Error:Execution failed for task &#39;:app:preDebugAndroidTestBuild&#39;.
- stateless 无状态组件
- Spring Framework 官方文档学习(一)介绍
- CENTOS7 YUM安装BOOST1.53(静态版本)
- [转载]uml 类图依赖与关联的区别