博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 1007 Quoit Design (最近点对问题)
阅读量:7099 次
发布时间:2019-06-28

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

Quoit Design

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 25335    Accepted Submission(s): 6716


Problem Description
Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.
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.
 

 

Input
The input consists of several test cases. For each case, the first line contains an integer N (2 <= N <= 100,000), the total number of toys in the field. Then N lines follow, each contains a pair of (x, y) which are the coordinates of a toy. The input is terminated by N = 0.
 

 

Output
For each test case, print in one line the radius of the ring required by the Cyberground manager, accurate up to 2 decimal places.
 
 

 

Sample Input
2 0 0 1 1 2 1 1 1 1 3 -1.5 0 0 0 0 1.5 0
 

 

Sample Output
0.71 0.00 0.75
 

 

Author
CHEN, Yue
 

 

Source
 

 

Recommend
JGShining   |   We have carefully selected several similar problems for you:            
 
1 //1468MS    2288K    1378 B    G++ 2 /* 3  4     题意; 5         给出n个点,求最近的两个点的距离的一般 6          7     最近点对: 8         要用到分治的思想做,是时间复杂度为O(nlgn),直接求会超时 9         最近点对问题在很多算法书和资料上都有讲到,主要思想是分治。 10     11     注意一点: 用C的 qsort排序一直TLE,表示有点无力.. 12 13 */14 #include
15 #include
16 #include
17 #include
18 #define N 10000519 using namespace std;20 struct node{21 double x,y; 22 }p[N];23 int a[N];24 int n;25 double cmpx(node a,node b)26 {27 return a.x
b?a:b;36 }37 inline double Min(double a,double b)38 {39 return a
>1;51 double d=Min(find(l,mid),find(mid+1,r));52 int cnt=0;53 for(int i=l;i<=r;i++){54 if(p[i].x>=p[mid].x-d && p[i].x<=p[mid].x+d)55 a[cnt++]=i;56 }57 sort(a,a+cnt,cmpy);58 for(int i=0;i
=d) break;61 d=Min(d,Dis(p[a[i]],p[a[j]]));62 }63 }64 return d;65 }66 int main(void)67 {68 while(scanf("%d",&n)!=EOF)69 {70 if(n==0) break;71 for(int i=0;i

 

转载于:https://www.cnblogs.com/GO-NO-1/p/3443630.html

你可能感兴趣的文章
java内存泄漏与内存溢出
查看>>
分布式与集群
查看>>
互联网服务器的实现过程需要考虑哪些安全问题 & 加解密及哈希知识点
查看>>
sql server2008给数据表,字段,添加修改注释
查看>>
meta标签清理缓存
查看>>
【数据结构】二叉树
查看>>
onvif开发之设备发现功能的实现--转
查看>>
虚拟机下linux迁移造成MAC地址异常处理办法
查看>>
数据库事务原子性、一致性是怎样实现的?[转]
查看>>
“营改增”后你该知道的…代开发票需要知道的16个事项
查看>>
arcgis10.1连接sqlserver数据库常见问题(转载)
查看>>
动态设置js的属性
查看>>
Fragment的setUserVisibleHint方法实现懒加载,但setUserVisibleHint 不起作用?
查看>>
@responsebody注解的作用就是让viewresolver不起作用,不返回视图名称而是直接返回的return object...
查看>>
lodash(二)对象+循环遍历+排序
查看>>
Eclipse快捷键大全
查看>>
Java -- 获取MAC地址
查看>>
Visual Prolog 的 Web 专家系统 (1)
查看>>
void 指针的转换
查看>>
再议Unity优化
查看>>