Classic ry, where the unit circle covers a maximum of points.
Here we use the O (N ^ 3) algorithm, which indicates that there is O (n ^ 2 * logn), but it won't.
Method: Enumerate any two points and use this as the string to create a new circle. (PS: Do not use the string center as the circle because the circle is not the largest.) Then enumerate all points and obtain the maximum value.
# Include <list> # include <map> # include <set> # include <queue> # include <string> # include <deque> # include <stack> # include <algorithm> # include <iostream> # include <iomanip> # include <cstdio> # include <cmath> # include <cstdlib> # include <limits. h> # include <time. h> # include <string. h> using namespace STD; # define ll long # define PI ACOs (-1.0) # define Max int_max # define min int_min # define EPS 1e-10 # define fre freopen ("a.txt ", "r", stdin) # define mod 1000000007 # define n 305 struct point {Double X, Y;} p [N]; double DIS (point a, point B) {// return (. x-b.x) * (. x-b.x) +. y-b.y) * (. y-b.y);} Point Gao (point a, point B) {point mid, TMP, P0; mid. X = (. X + B. x)/2; mid. y = (. Y + B. y)/2; double S = DIS (MID, a); s = SQRT (1.0-s); TMP. X = (. x-b.x); TMP. y = (. y-b.y); if (. X = B. x) {// The parallel Y axis of the string vertical line must be specially processed when x = mid. x; required y = mid. y-S;} else {double angle = atan (-TMP. x)/tmp. y); bytes X = mid. x-S * Cos (angle); // There are two possible cases here. You only need one of them (take the left or right) and choose y = mid. y-S * sin (angle);} return P0;} int main () {int N; int I, j; while (scanf ("% d", & N) & N) {for (I = 0; I <n; I ++) {scanf ("% lf", & P [I]. x, & P [I]. y);} int ans = 1; // the smallest vertex is for (I = 0; I <n; I ++) {for (j = I + 1; j <n; j ++) {If (DIS (P [I], p [J])> 4.0) continue; // If the square distance between the two circles is greater than 4, the point P0 cannot be intersecting; p0 = Gao (P [I], p [J]); // take the line of the two circles as the string and make the circle, and obtain the center int CNT = 0; For (int K = 0; k <n; k ++) {If (DIS (P0, P [k]) <= 1.00001) // CNT ++;} If (ANS <CNT) ans = CNT ;}} printf ("% d \ n", ANS);} return 0 ;}