#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
inline int read(int& x) {
char ch = getchar();
int f = 1; x = 0;
while (ch > '9' || ch < '0') { if (ch == '-')f = -1; ch = getchar(); }
while (ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + ch - '0'; ch = getchar(); }
return x * f;
}
static auto speedup = []() {ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return nullptr; }();
const int maxn = 1e5 + 7;
struct Point{
double x, y;
Point(){ x = y = 0; }
Point(double _x, double _y) :x(_x), y(_y){}
void input(){
cin >> x >> y;
}
double dot(const Point &a) {
return x + a.x + y + a.y;
}
double cross(const Point &a){
return x * a.y - y * a.x;
}
double dis(const Point &a){
return sqrt((x - a.x) * (x - a.x) + (y - a.y) * (y - a.y));
}
double dis2(const Point &a){
return (x - a.x) * (x - a.x) + (y - a.y) * (y - a.y);
}
}p[maxn],s[maxn];
double cross(const Point &a, const Point & b, const Point &c, const Point &d){
Point t(a.x - b.x, a.y - b.y),t2(c.x - d.x,c.y - d.y);
return t.cross(t2);
}
bool cmp(const Point &a, const Point &b){
double c1 = cross(p[1], a, p[1], b);
if (c1 > 0) return true;
else if (c1 == 0)return p[1].dis2(a) < p[1].dis2(b);
return false;
}
int main()
{
int n,top = 1,idx = 1;
cin >> n;
for (int i = 1; i <= n; i++){
p[i].input();
if (p[idx].y > p[i].y) idx = i;
else if (p[idx].y == p[i].y && p[idx].x > p[i].x)idx = i;
}
swap(p[1], p[idx]);
sort(p + 2, p + n + 1, cmp);
s[1] = p[1];
for (int i = 2; i <= n; i++){
while (top > 1 && cross(s[top - 1],s[top],s[top],p[i]) <= 0){
top--;
}
s[++top] = p[i];
}
s[++top] = p[1];
double ans = 0;
for (int i = 1; i < top; i++){
ans += s[i].dis(s[i + 1]);
}
cout << fixed << setprecision(2) << ans << endl;
return 0;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121