博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Naive and Silly Muggles HDU - 4720(计算几何)
阅读量:4136 次
发布时间:2019-05-25

本文共 1608 字,大约阅读时间需要 5 分钟。

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 x i and y i (|x i, y i| <= 10), indicating the three wizards’ positions. Then a single line with two numbers q x and q y (|q x, q y| <= 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
根hdu3007一样的思路。
代码如下:

#include
#define ll long longusing namespace std;struct node{
double x; double y; double r;}p[4];double x,y;inline double dis(node a,node b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}int main(){
int t; scanf("%d",&t); int cc=0; while(t--) {
for(int i=1;i<=3;i++) scanf("%lf%lf",&p[i].x,&p[i].y); scanf("%lf%lf",&x,&y); node ans;ans=p[1];ans.r=0.0; for(int i=2;i<=3;i++) {
if(dis(ans,p[i])<=ans.r) continue; ans=p[i];ans.r=0.0; for(int j=1;j

努力加油a啊,(o)/~

转载地址:http://fztvi.baihongyu.com/

你可能感兴趣的文章
DeepLearning tutorial(5)CNN卷积神经网络应用于人脸识别(详细流程+代码实现)
查看>>
DeepLearning tutorial(6)易用的深度学习框架Keras简介
查看>>
DeepLearning tutorial(7)深度学习框架Keras的使用-进阶
查看>>
流形学习-高维数据的降维与可视化
查看>>
Python-OpenCV人脸检测(代码)
查看>>
python+opencv之视频人脸识别
查看>>
人脸识别(OpenCV+Python)
查看>>
6个强大的AngularJS扩展应用
查看>>
网站用户登录系统设计——jsGen实现版
查看>>
第三方SDK:讯飞语音听写
查看>>
第三方SDK:JPush SDK Eclipse
查看>>
第三方开源库:imageLoader的使用
查看>>
自定义控件:飞入飞出的效果
查看>>
自定义控件:动态获取控件的高
查看>>
第三方开源库:nineoldandroid:ValueAnimator 动态设置textview的高
查看>>
第三方SDK:百度地图SDK的使用
查看>>
Android studio_迁移Eclipse项目到Android studio
查看>>
JavaScript setTimeout() clearTimeout() 方法
查看>>
CSS border 属性及用border画各种图形
查看>>
转载知乎-前端汇总资源
查看>>