Quoit Design
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 28373 Accepted Submission(s): 7417
In the field of Cyberground, the position of each toy is fixed, and the ring is carefully designed so it can only encircle one toy at a time. On the other hand, to make the game look more attractive, the ring is designed to have the largest radius. Given a configuration of the field, you are supposed to find the radius of such a ring.
Assume that all the toys are points on a plane. A point is encircled by the ring if the distance between the point and the center of the ring is strictly less than the radius of the ring. If two toys are placed at the same point, the radius of the ring is considered to be 0.
#include"iostream"
#include"algorithm"
#include"cmath"
#include"cstdio"
using namespace std;
#define min(a,b) ((a)>(b))?(b):(a)
struct point
{
double x,y;
}a[];
bool cmp(const point &a,const point &b)
{
if(a.x==b.x)
return a.y<b.y;
return a.x<b.x;
}
double dis(point a,point b)
{
return sqrt(pow(a.x-b.x,)+pow(a.y-b.y,));
}
double S(point a[],int n)
{
double m=0xffffff;
if(n==)
return dis(a[],a[]);
for(int i=;i<n-;i++)
{
m=min(m,min(dis(a[i],a[i+]),min(dis(a[i],a[i+]),dis(a[i+],a[i+]))));
}
return m;
}
int main()
{
int n;
while(scanf("%d",&n),n)
{
for(int i=;i<n;i++)
{
scanf("%lf%lf",&a[i].x,&a[i].y);
}
sort(a,a+n,cmp);
printf("%.2lf\n",S(a,n)/);
}
return ;
}
Quoit Design的更多相关文章
- HDU 1007 Quoit Design(二分+浮点数精度控制)
Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- HDU1007 Quoit Design 【分治】
Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- 杭电OJ——1007 Quoit Design(最近点对问题)
Quoit Design Problem Description Have you ever played quoit in a playground? Quoit is a game in whic ...
- ACM-计算几何之Quoit Design——hdu1007 zoj2107
Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- (hdu 7.1.8)Quoit Design(最低点——在n一个点,发现两点之间的最小距离)
主题: Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...
- Quoit Design(最近点对+分治)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1007 Quoit Design Time Limit: 10000/5000 MS (Java/Oth ...
- Quoit Design(hdu1007)最近点对问题。模版哦!
Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- ZOJ 2017 Quoit Design 经典分治!!! 最近点对问题
Quoit Design Time Limit: 5 Seconds Memory Limit: 32768 KB Have you ever played quoit in a playg ...
- poj 1007 Quoit Design(分治)
Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- HDU 1007 Quoit Design(经典最近点对问题)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1007 Quoit Design Time Limit: 10000/5000 MS (Java/Oth ...
随机推荐
- 第二百三十六天 how can I 坚持
太冷了,羽绒服没帽子,冻的耳朵疼. 她今天没有上班,原来是调休了. 其实应该是想到点啥,就应该写下,到晚上写就又忘了,什么都不记得了,这就是个需求吧. 睡觉.
- Spark shell的原理
Spark shell是一个特别适合快速开发Spark原型程序的工具,可以帮助我们熟悉Scala语言.即使你对Scala不熟悉,仍然可以使用这个工具.Spark shell使得用户可以和Spark集群 ...
- gdb之watch命令
[gdb之watch命令] 什么是watchpoint? watchpoint,顾名思义,其一般用来观察某个变量/内存地址的状态(也可以是表达式),如可以监控该变量/内存值是否被程序读/写情况. 在g ...
- centos安装postfixadmin
postfixadmin的安装,跟普通网站安装没什么区别 配置好虚拟目录,然后在数据库中创建数据库postfix 修改config.inc.php文件,详细搜索谷歌 访问http://www.你的域名 ...
- 咏南C/S开发框架支持最新的DELPHI XE8开发
特大好消息:咏南C/S开发框架支持最新的DELPHI XE8开发!咏南开发框架让你再无开发工具升级后顾之忧! 购买咏南开发框架送项目源码!
- unigui 导入导出数据
导入:首先要用TUniFileUpload将文件从客户端上传至服务端,然后完成导入. TUniFileUpload上传文件的演示代码: UniFileUpload1.Execute; UniFileU ...
- MySQL重置密码(OSX)
1.停止MySQL的服务 sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop 2.cd /usr/local/mysql/bin ./mysqld_ ...
- 监听UITextFiled输入文字长度的变化
需求:如果UITextFiled文字的长度大于零,改变一个按钮的颜色 1.一开始想到的当然是UITextFiled的代理方法,但是在UITextFiled的代理方法中并没有监听这个的这一选项!!! 2 ...
- java dbcp连接池的使用
package com.jb.jubmis.comm; import java.sql.Connection;import java.sql.ResultSet;import java.sql.SQL ...
- CentOS6 下MySQL option file
my.cnf内容如下 # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/e ...