#pragma warning(disable:4996)
#include<stdio.h>
#include<algorithm>
using namespace std;
struct point{
int x, y;
bool operator <(const point &p)const{
return x != p.x ? x < p.x : y < p.y;
}
}w[2010];
struct point2{
long long x, y;
bool operator <(const point2 &p)const{
return y*p.x < p.y*x;
}
}P[2010];
int n;
long double res, S, S2, T;
int main(){
scanf("%d", &n);
int i, j;
for (i = 0; i < n; i++){
scanf("%d%d", &w[i].x, &w[i].y);
}
if (n <= 2){
printf("0\n");
return 0;
}
sort(w, w + n);
for (i = 2; i < n; i++){
for (j = 0; j < i; j++)P[j].x = w[j].x - w[i].x, P[j].y = w[j].y - w[i].y;
sort(P, P + i);
S = 0, S2 = 0;
for (j = 0; j < i - 1; j++){
S += P[j].y, S2 += P[j].x;
res += S2*P[j + 1].y- S*P[j + 1].x;
}
}
T = n;
T = T*(T - 1)*(T - 2) / 3;
res /= T;
printf("%.12llf\n", res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1136 KB |
Output is correct |
2 |
Correct |
0 ms |
1136 KB |
Output is correct |
3 |
Correct |
0 ms |
1136 KB |
Output is correct |
4 |
Correct |
0 ms |
1136 KB |
Output is correct |
5 |
Correct |
0 ms |
1136 KB |
Output is correct |
6 |
Correct |
0 ms |
1136 KB |
Output is correct |
7 |
Correct |
0 ms |
1136 KB |
Output is correct |
8 |
Correct |
0 ms |
1136 KB |
Output is correct |
9 |
Correct |
0 ms |
1136 KB |
Output is correct |
10 |
Correct |
0 ms |
1136 KB |
Output is correct |
11 |
Correct |
28 ms |
1136 KB |
Output is correct |
12 |
Correct |
52 ms |
1136 KB |
Output is correct |
13 |
Correct |
32 ms |
1136 KB |
Output is correct |
14 |
Correct |
144 ms |
1136 KB |
Output is correct |
15 |
Correct |
12 ms |
1136 KB |
Output is correct |
16 |
Correct |
136 ms |
1136 KB |
Output is correct |
17 |
Correct |
8 ms |
1136 KB |
Output is correct |
18 |
Correct |
20 ms |
1136 KB |
Output is correct |
19 |
Correct |
32 ms |
1136 KB |
Output is correct |
20 |
Correct |
0 ms |
1136 KB |
Output is correct |
21 |
Correct |
160 ms |
1136 KB |
Output is correct |
22 |
Correct |
156 ms |
1136 KB |
Output is correct |
23 |
Correct |
160 ms |
1136 KB |
Output is correct |
24 |
Correct |
160 ms |
1136 KB |
Output is correct |
25 |
Correct |
156 ms |
1136 KB |
Output is correct |
26 |
Correct |
160 ms |
1136 KB |
Output is correct |
27 |
Correct |
156 ms |
1136 KB |
Output is correct |
28 |
Correct |
160 ms |
1136 KB |
Output is correct |
29 |
Correct |
152 ms |
1136 KB |
Output is correct |
30 |
Correct |
160 ms |
1136 KB |
Output is correct |
31 |
Correct |
0 ms |
1136 KB |
Output is correct |