#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <vector>#include <queue>#include <stack>#include <set>#include <map>#include <string>#include <math.h>#include <stdlib.h>#include <time.h>using namespace STD;structpoint{intx, y;} p[1024x768],ch[1024x768]; Pointoperator-(point A,point b) {point C; c.x=a.x-b.x; C.Y=A.Y-B.Y;returnC;}intCross (point A,point b) {returnA.X*B.Y-B.X*A.Y;}DoubleDot (point A,point b) {return sqrt((a.x-b.x) * (a.x-b.x) + (A.Y-B.Y) * (A.Y-B.Y));BOOLCMP (point A,point b) {if(a.x==b.x)returna.y<b.y;Else returna.x<b.x;}intMain () {inti,k,n,m,l;DoubleAns while(~scanf("%d%d", &n,&l)) { for(i=0; i<n;i++)scanf("%d%d", &P[I].X,&P[I].Y); Sort (p,p+n,cmp); m=0; for(i=0; i<n;i++) { while(m>1&&cross (ch[m-1]-ch[m-2],p[i]-ch[m-2]) <=0) m--; Ch[m++]=p[i]; } k=m; for(i=n-2; i>=0; i--) { while(M>k&&cross (ch[m-1]-ch[m-2],p[i]-ch[m-2]) <=0) m--; Ch[m++]=p[i]; }if(n>1) m--; ans=0; for(i=0; i<m;i++) {Ans+=dot (ch[i],ch[i+1]); }printf("%.0f\n", ans+2*3.1415926*L); }return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. http://xiang578.top/
POJ 1113 Wall Andrew