#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define rre(i,r,l) for(int i=(r);i>=(l);i--)
#define re(i,l,r) for(int i=(l);i<=(r);i++)
#define Clear(a,b) memset(a,b,sizeof(a))
#define inout(x) printf("%d",(x))
#define douin(x) scanf("%lf",&x)
#define strin(x) scanf("%s",(x))
#define LLin(x) scanf("%lld",&x)
#define op operator
#define CSC main
typedef unsigned long long ULL;
typedef const int cint;
typedef long long LL;
using namespace std;
double f(const long double &a){return a*a;}
const double inf=;
void inin(int &ret)
{
ret=;int f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=;ch=getchar();}
while(ch>=''&&ch<='')ret*=,ret+=ch-'',ch=getchar();
ret=f?-ret:ret;
}
struct xl
{
double x,y;
void in(){douin(x),douin(y);}
xl(double x=,double y=):x(x),y(y){}
bool op < (const xl &rhs)const {return x==rhs.x?y<rhs.y:x<rhs.x;}
};
xl di[];
int wocao[];
int n,top;
bool com(const int &a,const int &b)
{
return di[a].y<di[b].y;
}
double dis(const xl &a,const xl &b)
{
return sqrt(f(a.x-b.x)+f(a.y-b.y));
}
double mindis(int l,int r)
{
double ret=inf;
if(l==r)return ret;
if(r-l+<=)
{
re(i,l,r)re(j,i+,r)
ret=min(ret,dis(di[i],di[j]));
return ret;
}
int mid=(l+r)>>;
ret=min(mindis(l,mid),mindis(mid+,r));
top=;
re(i,l,r)
{
double temp=abs(di[mid].x-di[i].x);
if(temp<=ret)wocao[++top]=i;
}
sort(wocao+,wocao+top+,com);
re(i,,top)
re(j,i+,top)
{
if(di[wocao[j]].y-di[wocao[i]].y>=ret)break;
ret=min(ret,dis(di[wocao[i]],di[wocao[j]]));
}
top=;
return ret;
}
int main()
{
while(~scanf("%d",&n)&&n)
{
re(i,,n)di[i].in();
sort(di+,di+n+);
printf("%.2f\n",mindis(,n)/);
}
return ;
}

hud1007 Quoit Design的更多相关文章

  1. HDU 1007 Quoit Design(二分+浮点数精度控制)

    Quoit Design Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

  2. HDU1007 Quoit Design 【分治】

    Quoit Design Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

  3. 杭电OJ——1007 Quoit Design(最近点对问题)

    Quoit Design Problem Description Have you ever played quoit in a playground? Quoit is a game in whic ...

  4. ACM-计算几何之Quoit Design——hdu1007 zoj2107

    Quoit Design Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

  5. (hdu 7.1.8)Quoit Design(最低点——在n一个点,发现两点之间的最小距离)

    主题: Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...

  6. Quoit Design(最近点对+分治)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1007 Quoit Design Time Limit: 10000/5000 MS (Java/Oth ...

  7. Quoit Design(hdu1007)最近点对问题。模版哦!

    Quoit Design Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...

  8. ZOJ 2017 Quoit Design 经典分治!!! 最近点对问题

    Quoit Design Time Limit: 5 Seconds      Memory Limit: 32768 KB Have you ever played quoit in a playg ...

  9. poj 1007 Quoit Design(分治)

    Quoit Design Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

随机推荐

  1. [硬件]Robot运动控制

    思考问题:机器人运动控制如何与图形界面交互? 不得不说,先锋机器人的软件做的真不怎么样.图形界面交互用户体验很差. 现在我遇到一个很现实的问题:SLAM需要采集激光数据和机器人的位姿,同时我还要再这个 ...

  2. drf解析器

    1.简介 作用:将传过来的数据,解析成字典 2.使用 分为局部使用和全局使用 局部使用,什么都不写,默认就是 parser_classes = [JSONParser,FormParser] from ...

  3. 微信小程序github源码

    https://github.com/justjavac/awesome-wechat-weapp https://www.cnblogs.com/tuyile006/p/6268961.html h ...

  4. (转)以太坊(Ethereum)全零地址(0x000000...)揭秘

    最近,一位小伙伴向我咨询问题,说他发现了一个诡异的现象.以太坊的区块链中居然有全是0的地址:0x0000000000000000000000000000000000000000 这究竟是怎么回事儿呢? ...

  5. Notes for Neural Network Methods for Natural Language Processing

    什么是深度学习?   一种机器学习算法,based on [多层][非线性变换]的[神经网络]结构 优点:可以使用 低维 稠密 连续 的向量表示不同粒度的语言单元, 还可以使用循环.卷积.递归等神经网 ...

  6. [LeetCode] 872. Leaf-Similar Trees_Easy tag: DFS

    Consider all the leaves of a binary tree.  From left to right order, the values of those leaves form ...

  7. [LeetCode] 98. Validate Binary Search Tree_Medium

    Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as ...

  8. Hadoop2.6的DataNode启动不了

    2016-05-04 18:14:51,990 INFO org.apache.hadoop.ipc.Server: IPC Server Responder: starting 2016-05-04 ...

  9. Stephen Wolfram自述

    Stephen Wolfram自述   作者: 阮一峰 大家听说过Stephen Wolfram(斯蒂芬·沃尔夫勒姆)吗? 了解他的经历和成就吗? 我对他了解不多,但是读了下面这篇2005年的演讲,联 ...

  10. 从零开始一起学习SLAM | 相机成像模型

    上一篇文章<从零开始一起学习SLAM | 为啥需要李群与李代数?>以小白和师兄的对话展开,受到了很多读者的好评.本文继续采用对话的方式来学习一下相机成像模型,这个是SLAM中极其重要的内容 ...