POJ 3608 Bridge Across Islands
题意 旋转卡壳。 先找第一个凸包上纵坐标最小的点 \(p\) 和第二个凸包上纵坐标最大的点 \(q\) ,之后旋转卡壳,求两条线段之间的最短距离。 code: #include<cstdio> #include<iostream> #include<cmath> #include<algorithm> using namespace std; const int maxn=10010; const double eps=1e-10; const double inf=0x3f3f3f3f; int n,m; struct Point { double x,y; inline double len(){return sqrt(x*x+y*y);} Point operator+(const Point a)const { Point res; res.x=x+a.x,res.y=y+a.y; return res; } Point operator-(const Point a)const { Point res; res.x=x-a.x,res.y=y-a.y; return res; } Point operator*(double k)const { Point res; res.x=x*k,res.y=y*k; return res; } Point operator/