hdu 1007 Quoit Design 最近点对(分治)

##代码

#include
#include   
#include   
#include   
#define MAXN 100005  
//#define min(a,b) (ax-p2->x)*(p1->x-p2->x)+(p1->y-p2->y)*(p1->y-p2->y));  
}  
bool cmpx(Point *p1,Point *p2) {return p1->xx;}  
bool cmpy(Point *p1,Point *p2) {return p1->yy;}  
double min(double a,double b){return a>1;  
    double ans=min(closest(s,mid),closest(mid+1,e));//递归求解  
    int i,j,cnt=0;  
    for(i=s;i<=e;i++)//把x坐标在px[mid].x-ans~px[mid].x+ans范围内的点取出来  
    {  
        if(px[i]->x>=px[mid]->x-ans&&px[i]->x<=px[mid]->x+ans)  
            py[cnt++]=px[i];  
    }  
    sort(py,py+cnt,cmpy);//按y坐标排序  
    for(i=0;iy-py[i]->y>=ans)  
                break;  
            ans=min(ans,get_dis(py[i],py[j]));  
        }  
    }  
    return ans;  
}  
int main()  
{  
    int i,n;  
    while(scanf("%d",&n)!=EOF)  
    {  
        if(n==0)  
            break;  
        for(i=0;i

你可能感兴趣的:(计算几何,题解)