Easy to know
The convex hull is first asked, and then the arc part is related to each inner angle
After calculation, it is found that the arcs add up to a circle
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include < algorithm> #include <cstdlib> #include <cmath> #include <map> #include <sstream> #include <queue> #include <vector> #define MAXN 111111 #define MAXM 211111 #define PI acos ( -1.0) #define EPS 1e-8 #defi
NE INF 1000000001 using namespace std;
int dblcmp (double d) {if (Fabs (d) < EPS) return 0; Return d > EPS?
1:-1;
} struct Point {double x, y;
Point () {}-point (double _x, double _y): X (_x), Y (_y) {};
void input () {scanf ("%lf%lf", &x, &y);
} double dot (point P) {return x * p.x + y * P.Y;
} double distance (point P) {return hypot (x-p.x, Y-P.Y);
} point Sub (point P) {return point (x-p.x, y-p.y);
} double det (point p) {return x * p.y-y * p.x; } bool operator < (point a) const {REturn dblcmp (a.x-x) = = 0?
DBLCMP (Y-A.Y) < 0:x < a.x;
}}P[MAXN];
struct Line {point A, B;
Line () {} line (point _a, point _b) {a = _a; b = _b;}};
struct polygon {int n;
Point P[MAXN];
Line L[MAXN];
Double area;
Double circum;
void input () {for (int i = 0; i < n; i++) p[i].input ();
} void Getline () {for (int i = 0; i < n; i++) L[i] = line (P[i], p[(i + 1)% n]);
} void Getarea () {area = 0;
int a = 1, b = 2;
while (b <= n-1) {area + = P[a].sub (p[0]). Det (p[b].sub (p[0)));
a++;
b++;
} area = fabs (area)/2;
} void Getcircum () {circum = 0;
for (int i = 0; i < n; i++) Circum + = L[i].a.distance (l[i].b);
}}convex;
BOOL Conpoint (point P[],int N) {for (int i = 1; i < n; i++) if (dblcmp (p[i].x-p[0].x)! = 0 | | DBLCMP (p[i].y-p[0].Y)! = 0) return false;
return true; } bool Conline (point P[],int N) {for (int i = 2; i < n; i++) if (dblcmp (P[1].sub (p[0)). Det (p[i].sub (p[0)))
)! = 0) return false;
return true;
} void Getconvex (Point p[], int. N, Point res[], int& resn) {resn = 0;
if (Conpoint (P, N)) {res[resn++] = p[0];
Return
} sort (p, p + N);
if (Conline (p,n)) {res[resn++] = p[0];
res[resn++] = p[n-1];
Return } for (int i = 0; i < n;) if (Resn < 2 | | dblcmp (RES[RESN-1].SUB (res[resn-2]). Det (P[i].sub (res[resn
-1]))) > 0) res[resn++] = p[i++];
else--RESN;
int top = resn-1; for (int i = n-2; I >= 0;) if (RESN < top + 2 | | dblcmp (RES[RESN-1].SUB (res[resn-2]). Det (P[i].sub (res[
Resn-1]))) > 0) res[resn++] = p[i--];
else--RESN;
resn--;
} double L;
int n; int main () {while (scanf ("%d%lf", &n, &l)! = EOF) {for (int i = 0; i < n; i++) p[i].input ();
Getconvex (P, N, CONVEX.P, CONVEX.N);
Convex.getline ();
Convex.getcircum ();
printf ("%d\n", (int) (2 * L * PI + convex.circum + 0.5));
} return 0; }