Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<iostream>#include<cmath>#include<algorithm>//本题是二维平面内的很多个点,一个固定半径的圆可以覆盖最多多少个点//O(n^3)的解法,用两点确定一个圆,判断圆内的点的数量//O(n^2logn)的解法,一个点与据此点2R以内的点画圆,相交的一段弧,则包括这两个点的圆心在这段弧内//判断其他点在该圆上的弧区间并排序(nlogn)然后便利所有点using namespace std;double R;int N;struct point {double x; double y;point(double a, double b) :x(a), y(b) {}point() = default;};point A[2005];double dis(const point &a, const point &b){return sqrt(pow(a.x - b.x,2) + pow(a.y - b.y,2));}point getheart(const point &a, const point &b){if (dis(a, b) == 2 * R)return point(a.x - b.x, a.y - b.y);else