2 shunfurh shunfurh 于 2017.08.30 11:30 提问

Naive and Silly Muggles

Problem Description
Three wizards are doing a experiment. To avoid from bothering, a special magic is set around them. The magic forms a circle, which covers those three wizards, in other words, all of them are inside or on the border of the circle. And due to save the magic power, circle's area should as smaller as it could be.
Naive and silly "muggles"(who have no talents in magic) should absolutely not get into the circle, nor even on its border, or they will be in danger.
Given the position of a muggle, is he safe, or in serious danger?

Input
The first line has a number T (T <= 10) , indicating the number of test cases.
For each test case there are four lines. Three lines come each with two integers xi and yi (|xi, yi| <= 10), indicating the three wizards' positions. Then a single line with two numbers qx and qy (|qx, qy| <= 10), indicating the muggle's position.

Output
For test case X, output "Case #X: " first, then output "Danger" or "Safe".

Sample Input
3
0 0
2 0
1 2
1 -0.5

0 0
2 0
1 2
1 -0.6

0 0
3 0
1 1
1 -1.5

Sample Output
Case #1: Danger
Case #2: Safe
Case #3: Safe

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.14 23:49
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
Naive and Silly Muggles(计算几何 判断点是否在三点形成的最小圆内)
Naive and Silly Muggles(计算几何 判断点是否在三点形成的最小圆内)
Naive and Silly Muggles
#include #include #include #include #include #include #include #include using namespace std; struct point{double x, y;}p[5]; double dist(point a, point b) { return sqrt((a.x-b.x)*(a.x-b.x)
hdu4720-(Naive and Silly Muggles)
补题中,这道题数据有点弱。     题目大意:给一个三角形的三个顶点的坐标,再给出一个点的坐标(x,y),问最后这个点(x,y)是否落在由三角形构成的最小的圆里面(包括圆的边)。题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4720。     思路:这道题队友写的,后来我补题的时候才发现他的思路不太对,但却ac了,他直接求三角形的重心算出圆的半径
HDU 4720 Naive and Silly Muggles
题意: 问三点的最小包络圆 是否包含第四个点? 分析:模板题,但需要注意分锐角,钝角两种情况。 代码: #include #include #include using namespace std; #define PI 3.141592653589793 struct point { double x; double y; }; struct Line {
hdu 4720 Naive and Silly Muggles
题目大意:给出三个点,确定一个包含三个点的最小圆,然后判断点p是否在圆内(包括边上)还是圆外,前者输出Danger,后者输出Safe。 解题思路:1)如果三点共线,则最小圆的圆心即为最长边的中点                     2)如果三点构成的三角形是锐角三角形,则最小圆的圆心即为三角形的外心                     3)如果三点构成的三角形是钝角三角形或直
HDU 4720 :Naive and Silly Muggles
题目:HDU 4720 :Naive and Silly Muggles 题目大意:这题的意思是给出三个点, 然后在给出另一个点,问这个点会不会在覆盖前面三个点的最小的圆里面(包括边界), 在里面最输出danger, 如果任何情况下这个点都不在圆里面,那么就输出safe。 解题思路:三个点最小的覆盖的圆是三角形的外接圆,这样的圆面积一定是最小的。 但是相同面积的圆,所在的位置,
POJ 4720 Naive and Silly Muggles -
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4720 求围住一个三角形的最小圆 如果是钝角,那么圆的直径就是最长的那条边其他情况圆是三角形的外接圆 可用以下方法求的外心: 给定三角形三个顶点的坐标,如何求三角形的外心的坐标呢? 例如 :给定a(x1,y1) b(x2,y2) c(x3,y3)求外接圆心坐标O(x,y)
hdu(4720) Naive and Silly Muggles
题意:前三个点坐标,要找到一个最小的圆能覆盖这三个点;若第四个点在这个圆外则输出Safe,否则输出 Danger; 前三个点确定一个三角形,若这个三角形是直角三角形或钝角三角形,则圆心在最长边的中点,半径是其一半; 如果为锐角三角形,               则利用公式;             x0=((y2-y1)*(y3*y3-y1*y1+x3*x3-x1*x1)-(y3-y1)
HDU 4720 Naive and Silly Muggles
Description Three wizards are doing a experiment. To avoid from bothering, a special magic is set around them. The magic forms a circle, which covers those three wizards, in other words, all of the
HDU 4720 Naive and Silly Muggles
Naive and Silly Muggles                                                                      Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)