http://www.lydsy.com/JudgeOnline/problem.php?id=1913 (Topic link)
Test instructions
gives the desired value of the points contained in a circle at any of the 3 points on a plane with n points.
Solution
This problem can be translated into convex polygon problem solving (of course I didn't think of it). Left-turn: http://blog.csdn.net/regina8023/article/details/45556321
Details
Note that the array that holds the polar angle is opened to twice times.
Code
bzoj1913#include<algorithm> #include <iostream> #include <cstdlib> #include <cstring># include<cstdio> #include <cmath> #include <queue> #define LL long long#define inf 2147483640#define EPS 1e-6#define Pi ACOs ( -1.0) #define FREE (a) freopen (a ".", "R", stdin), Freopen (a ". Out", "w", stdout), using namespace std; const int maxn=2000;struct Point {int x, y;} P[MAXN]; LL C[MAXN][MAXN];d ouble a[maxn<<1];int n;int Main () {scanf ("%d", &n), for (int i=1;i<=n;i++) scanf ("%d%d", & AMP;P[I].X,&P[I].Y); for (int i=0;i<=n;i++) c[i][0]=1;for (int. i=1;i<=n;i++) for (int j=1;j<=i;j++) C[I][J] =C[I-1][J]+C[I-1][J-1]; LL t2,t1=0;for (int i=1;i<=n;i++) {int cnt=0;for (int j=1;j<=n;j++) if (i!=j) {a[++cnt]=atan2 (p[j].y-p[i].y,p[j]. x-p[i].x); if (a[cnt]<0) A[cnt]+=2*pi;} Sort (a+1,a+cnt+1), for (int j=1;j<=cnt;j++) a[j+cnt]=a[j]+2*pi;for (int. j=1,k=1;j<=cnt;j++) {while (A[k+1]-a[j] <pi && k<2*cnt) k++;t1-=c[k-j][2]; Number of convex polygons}t1+=c[n-1][3];}t2=c[n][4]-t1;printf ("%.6lf", (double) (t1+t2*2)/c[n][3]+3); return 0;}
"bzoj1913" apio2010-signaling signal coverage