poj1113 求凸包 計算凸包周長

2021-06-22 19:44:19 字數 832 閱讀 1528

經典的求凸包題,模板題。

要求用資源最少,那肯定這個多邊形是個凸多邊形,也就是凸包。

所以先求出凸包,計算它的周長。還有就是這道題所說的,要離城牆l遠,其實就是在加上乙個圓的周長,圓的半徑就是l。

都說到這了,這道題還差什麼?還差乙個經典的凸包模板!哈哈~

**如下:

#include#include#include#include#include#define eps 1e-8

#define max 1111

#define pi acos(-1.0)

using namespace std;

struct point

};point point[max];

point ch[max];

int n,l;

double ans;

typedef point vector;

vector operator + (vector a, vector b)

vector operator - (point a, point b)

vector operator * (vector a, double p)

vector operator / (vector a, double p)

bool operator < (const point &a,const point &b)

int k=m;

for(int i=n-2;i>=0;i--)

if(n>1) m--;

return m;

}void input()

{ int i,j;

for(i=0;i

凸包計算 POJ1113

題目中除了要計算凸包之外,還要求修理的城牆要和宮殿之間的距離不小於l,那麼也就是相對於宮殿長度之外,多了乙個一l為半徑的圓的距離,所以題目就得以解決 poj1113 include include include include using namespace std typedef long lo...

poj 1113 凸包模板

include include include include include include using namespace std define n 1050 define pi acos 1.0 int n,r struct point point operator point b const...

凸包初學(POJ1113)

第一道凸包的題目。凸包 對乙個簡單多邊形來說,如果給定其邊界上或者內部上的兩個點,連線著兩個點 連線這兩個點的線段上的所有點都被包含在該多邊形的邊界上或內部的話,則該多邊形為凸多邊形 給你一些點,用這些點連出凸多邊形,要求所有點都在所連成的凸多邊形邊界或內部。選擇乙個左下角的左邊點 當做起始點。鏈結...