#include<cmath>
#include<cstdio>
#include<iostream>
#include<algorithm>
#define maxn 5005
using namespace std;
struct point
{
double x,y;
point(){}
point(double x1,double y1){x=x1,y=y1;}
double operator %(const point &A) const
{ return x*A.y-y*A.x;}
double operator *(const point &A) const
{ return x*A.x+y*A.y;}
point operator -(const point &A) const
{ return point(x-A.x,y-A.y);}
point operator +(const point &A) const
{ return point(x+A.x,y+A.y);}
};
point p[maxn],S[maxn];int top;
bool cmp(point A,point B)
{return A.x<B.x||(A.x==B.x&&A.y<B.y);}
double pw(double x){return x*x;}
double Cross(point A,point B,point C)
{return (B-A)%(C-A);}
double dis(point A,point B)
{return sqrt(pw(A.x-B.x)+pw(A.y-B.y));}
int n;
double ans;
void get_Tubao()
{
sort(p+1,p+n+1,cmp);
for(int i=1;i<=n;i++)
{
while(top>1&&Cross(S[top-1],p[i],S[top])<=0) top--;
S[++top]=p[i];
}
int j=top;
for(int i=n;i>=1;i--)
{
while(top>j&&Cross(S[top-1],S[top])<=0) top--;
S[++top]=p[i];
}
for(int i=1;i<top;i++)
ans+=dis(S[i],S[i+1]);
ans+=dis(S[1],S[top]);
}
int main()
{
scanf("%d",&n);
int x,y;
for(int i=1;i<=n;i++)
{
scanf("%d%d",&x,&y);
p[i].x=(double)x;
p[i].y=(double)y;
}
get_Tubao();
printf("%.2lf",ans);
return 0;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。