推薦部落格 :借鑑
分別列舉每個凸包的每條邊,再列舉另乙個凸包的點,求得一對對踵點,與當前記錄的值相取捨。
遍歷到下一條邊,從上次便利到的點開始尋找下一對踵點,再取捨......。直至取捨出最長、最短距離。
*/#include
#include
#include
using namespace std;
const int maxn=50001;
struct node
st[maxn],num[maxn];
int n,k,e;
double dis(node p1,node p2)
int multi(node p1,node p2,node p3)//叉積
bool cmp(node p1,node p2)
}double rotating_calipers()
return ans;
}int main()
swap(num[0],num[k]);
//printf("%d\n",k);
graham();
printf("%.0lf\n",rotating_calipers());
return 0;
}
Poj2187 凸包求最大距離
凸包 暴力求解,注意n 0,和n 1的情況 include include include include include include include define maxn 50000 10 using namespace std typedef struct point point int ...
poj2187 凸包問題
pseudo code graham scan algorithm input a set of pointss select the rightmost lowest point p0 ins.sortsangularly about p0 as a center.for ties,discard...
poj2187 凸包直徑模板
include include include include using namespace std define inf 50005 struct node node point inf int n,s inf top double cross node a,node b,node c doub...