#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std; struct node
{
double x,y;
}point[];
int n; bool hAlignLess(node p1,node p2)
{
if(p1.x != p2.x) return p1.x < p2.x;
else return p1.y < p2.y;
} double getDist(node p1, node p2)
{
return sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y));
} double getMin(double a, double b)
{
return a<b?a:b;
} double solve(int l,int r)
{
if(l == r)
return ;
if(l == r - )
return getDist(point[l],point[r]);
if(l == r - )
return getMin(getMin(getDist(point[l],point[l+]),getDist(point[l+],point[l+])),getDist(point[l],point[l+]));
int i,j,mid = (l+r) >> ;
double curmin = getMin(solve(l,mid),solve(mid+,r));
for(i=l;i<=r;i++)
for(j=i+;j<=i+ && j<=r;j++)
{
curmin = getMin(curmin,getDist(point[i],point[j]));
}
return curmin;
} int main() {
int i;
while(scanf("%d",&n)!=EOF && n){
for(i = ; i < n; i++){
scanf("%lf %lf",&point[i].x,&point[i].y);
}
sort(point,point+n,hAlignLess);
double ans = solve(,n-);
printf("%.2lf\n",ans/);
}
return ;
}

hd1007的更多相关文章

随机推荐

  1. oracle 数据定义语言(DDL)语法

    DDL语言包括数据库对象的创建(create).删除(drop)和修改(alter)的操作 1.创建表语法 create table table_name( column_name datatype  ...

  2. tensorflow学习之(十)使用卷积神经网络(CNN)分类手写数字0-9

    #卷积神经网络cnn import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #数据包,如 ...

  3. call和apply(学习笔记)

    call() call() 方法调用一个函数, 其具有一个指定的this值和分别地提供的参数(参数的列表). 语法: function.call(thisArg, arg1, arg2, ...) 参 ...

  4. opencv2.4.13+python2.7学习笔记--OpenCV中的图像处理--图像轮廓

    阅读对象:无要求. 1.代码 ''' OpenCV中的轮廓 轮廓可以简单认为成将连续的点(连着边界)连在一起的曲线,具有相同的颜色或者灰度.为了更加准确,要使用二值化图像.在寻找轮廓之前,要进行阈值化 ...

  5. index.php入口文件至根目录

      登录|注册       咖啡如同生活的专栏 从不羡慕别人的优秀,因为相信自己也可以优秀. 闲下来时看看书,书本里的故事,总有你学到的人生.       目录视图 摘要视图 订阅 异步赠书:9月重磅 ...

  6. 简析 __init__、__new__、__call__ 方法

    简析 __init__.__new__.__call__ 方法 任何事物都有一个从创建,被使用,再到消亡的过程,在程序语言面向对象编程模型中,对象也有相似的命运:创建.初始化.使 用.垃圾回收,不同的 ...

  7. opencl 参考源码及benchmark

    转载:https://www.zhihu.com/question/25539755/answer/44917891 CUDA 5之前的版本有OpenCL的sample,可以上网找找看 AMD APP ...

  8. CSU1333最短路问题SPFA

    fastvj.rainng.com/contest/236779#problem/I Description: n个点m条路每条路 l,r,t:表示这条路开l秒,关r秒,通过要t秒,问你车辆从s到t最 ...

  9. 【备忘】ASP.NET MVC 5 升级到 ASP.NET Core MVC 的部分变化

    正在将一个 .net 4.5 的项目(MVC 5)升级到 .net core 2.1,中间遇到了许多的修改,记在下面,帮大家少走弯路. System.Drawing 下面很多类已经不存在(如Bitma ...

  10. [转]Kaldi命令词识别

    转自: http://www.jianshu.com/p/5b19605792ab?utm_campaign=maleskine&utm_content=note&utm_medium ...