Naive and Silly Muggles hdu4720
Naive and Silly Muggles
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 452 Accepted Submission(s): 307
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?
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.
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
Case #2: Safe
Case #3: Safe
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;
double p[][],x,y;
void fun()
{
double a=*(p[][]-p[][]);
double a1=*(p[][]-p[][]);
double b=*(p[][]-p[][]);
double b1=*(p[][]-p[][]);
double c=p[][]*p[][]+p[][]*p[][]-p[][]*p[][]-p[][]*p[][];
double c1=p[][]*p[][]+p[][]*p[][]-p[][]*p[][]-p[][]*p[][];
x=(a1*c-a*c1)/(b*a1-b1*a);
y=(c*b1-c1*b)/(b1*a-b*a1);
}
double dis(int k)
{
double sum;
sum=sqrt((x-p[k][])*(x-p[k][])+(y-p[k][])*(y-p[k][]));
return sum;
}
int main()
{
int t,i,j,n;
scanf("%d",&t);
for(i=; i<=t; i++)
{
for(j=; j<; j++)scanf("%lf%lf",&p[j][],&p[j][]);
printf("Case #%d: ",i);
double a=((p[][]-p[][])*(p[][]-p[][])+(p[][]-p[][])*(p[][]-p[][]));
double b=((p[][]-p[][])*(p[][]-p[][])+(p[][]-p[][])*(p[][]-p[][]));
double c=((p[][]-p[][])*(p[][]-p[][])+(p[][]-p[][])*(p[][]-p[][]));
if(a*a+b*b<c*c)
{
x=(p[][]+p[][])/;
y=(p[][]+p[][])/;
}
else if(a*a+c*c<b*b)
{
x=(p[][]+p[][])/;
y=(p[][]+p[][])/;
}
else if(b*b+c*c<a*a)
{
x=(p[][]+p[][])/;
y=(p[][]+p[][])/;
}
else
{
fun();
}
double di=dis();
double di1=dis();
if(di<di1)
{
cout<<"Safe"<<endl;
}
else cout<<"Danger"<<endl;
}
}
Naive and Silly Muggles hdu4720的更多相关文章
- ACM学习历程—HDU4720 Naive and Silly Muggles(计算几何)
Description Three wizards are doing a experiment. To avoid from bothering, a special magic is set ar ...
- 计算几何 HDOJ 4720 Naive and Silly Muggles
题目传送门 /* 题意:给三个点求它们的外接圆,判断一个点是否在园内 计算几何:我用重心当圆心竟然AC了,数据真水:) 正解以后补充,http://www.cnblogs.com/kuangbin/a ...
- Naive and Silly Muggles
Problem Description Three wizards are doing a experiment. To avoid from bothering, a special magic i ...
- 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 (简单计算几何)
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 ...
- 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 解题报告:给出一个三角形的三个顶点坐标,要求用一个最小的圆将这个三个点都包含在内,另外输入一个点 ...
随机推荐
- python3 安装及项目管理安装
python3 一.下载安装 地址:https://www.python.org/downloads/ 安装:傻瓜式安装:我的目录如下 二.环境配置 [右键计算机]-->[属性]-->[高 ...
- idea 远程调试
Idea 远程在线测试 描述:在window下开发,部署到Linux服务器上,往往会遇到在windows下正常运行,在Linux服务器下异常,这是需要本地调试远程代码: 操作步骤: 一.代码已知 保证 ...
- 支付宝小程序PHP全栈开发--前端样式的设计.acss样式详解
关于.acss文件 在视频中已经说过了,小程序的设计思想和原生app的设计思想颇为相似,基本的应用单元为页面.当然对于一个页面来说每一个元素的放置位置在哪儿以及显示成什么样子这个是由样式来决定的.我们 ...
- memcache的原理和命中率的总结
详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt267 1 Memcache是什么Memcache是danga.c ...
- JavaScript学习日志(六):事件
这篇随笔,深恶痛绝,敲到快结束的时候,凌晨00:19,突然闪退,也不知道是Mac的原因还是chrome的原因,重新打开的时候,以为自动保存有效果,心想没关系,结果他么的只保存了四分之一,WTF?!!! ...
- [iOS] file patterns: The `public_header_files` pattern did not match any file.
由于之前集成私有pod,遇到问题, 默认的头文件目录设置为:s.public_header_files = ‘Pod/Classes/**/*.h’:但是如果Classes目录中,你的代码文件夹层次结 ...
- Python 进程与线程小随笔
Process 涉及模块:multiprocessing Process p = Process() p.start() p.join() from multiprocessing import Pr ...
- 转:【Java并发编程】之八:多线程环境中安全使用集合API(含代码)
转载请注明出处:http://blog.csdn.net/ns_code/article/details/17200509 在集合API中,最初设计的Vector和Hashtable是多线程安 ...
- 命令行利用KVM创建虚拟机
一,实验环境 OS:CENTOS6.5 X86_64 二,KVM宿主环境配置 1.cat /proc/cpuinfo | egrep 'vmx|svm' //查看是否支持虚拟技术 2.安装KVM相关 ...
- 201521123101 《Java程序设计》第8周学习总结
1. 本周学习总结 2. 书面作业,本次作业题集集合 1.List中指定元素的删除(题目4-1) 1.1 实验总结 学习使用泛型,熟悉定义泛型,熟悉List中实现删除 2.统计文字中的单词数量并按出现 ...