计算几何 HDOJ 4720 Naive and Silly Muggles
/*
题意:给三个点求它们的外接圆,判断一个点是否在园内
计算几何:我用重心当圆心竟然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
*/
计算几何 HDOJ 4720 Naive and Silly Muggles的更多相关文章
- HDU 4720 Naive and Silly Muggles (简单计算几何)
Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- HDU 4720 Naive and Silly Muggles (外切圆心)
Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...
- HDU 4720 Naive and Silly Muggles 2013年四川省赛题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4720 题目大意:给你四个点,用前三个点绘制一个最小的圆,而这三个点必须在圆上或者在圆内,判断最一个点如 ...
- HDU 4720 Naive and Silly Muggles 平面几何
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4720 解题报告:给出一个三角形的三个顶点坐标,要求用一个最小的圆将这个三个点都包含在内,另外输入一个点 ...
- Naive and Silly Muggles (计算几何)
Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- ACM学习历程—HDU4720 Naive and Silly Muggles(计算几何)
Description Three wizards are doing a experiment. To avoid from bothering, a special magic is set ar ...
- Naive and Silly Muggles
Problem Description Three wizards are doing a experiment. To avoid from bothering, a special magic i ...
- Naive and Silly Muggles hdu4720
Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- HDU-4720 Naive and Silly Muggles 圆的外心
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4720 先两两点之间枚举,如果不能找的最小的圆,那么求外心即可.. //STATUS:C++_AC_0M ...
随机推荐
- Sed替换行和字符shell
1.在某一行后面追加一行 RD=2000sed -i '/ssi_types/ a\limit_req zone=lreq burst='$RD';' /opt/bee.location 2.替换字符 ...
- [Effective JavaScript 笔记] 第2条:理解JavaScript的浮点数
JavaScript数值型类型只有数字 js只有一种数值型数据类型,不管是整数还是浮点数,js都把归为数字. typeof 17; // “number” typeof 98.6; // “num ...
- UINavigation拖动翻页
#import <UIKit/UIKit.h> #import "ViewController.h" //window窗口 #define WINDOW [[UIApp ...
- 他们在军训,我在搞OI(三)
昨天忘记写了,因为急着去看 51nod 比赛,然而思考了许久还是一道都不会,好菜啊T_T... 补一下 Day 3 的情况. Day 3 上午还是常规地做 vjudge 上的套题,硬着头皮啃英文,感觉 ...
- django-cms 代码研究(七)杂七杂八
实体关系图 核心对象: cms_page/cms_placeholder/cms_cmsplugin. page模型类继承关系图 CMSPlugin&Placeholder模型类继承关系图 = ...
- Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point t ...
- Xenomai 安装准备工作
一些安装xenomai的参考资料: http://my.oschina.net/hevakelcj/blog/124290 http://blog.sina.com.cn/s/blog_60b9ee1 ...
- sqltext的参数化处理
说到sql的参数化处理,我也是醉了,因为sql引擎真的是一个无比强大的系统,我们平时做系统的时候都会加上缓存,我想如果没有缓存,就不会有什么 大网站能跑的起来,而且大公司一般会在一个东西上做的比较用心 ...
- 【USACO】packrec
这道题卡了很久,开始没读清楚题,没看到题目中给的6个组合是仅可能的组合,一直自己想有多少种组合方式.后来才发现,于是就想到写遍历.我想的是,这六种情况下,每个位置摆哪个矩形是不确定的,于是可以对方块的 ...
- CodeForces - 404B(模拟题)
Marathon Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Sta ...