Boundary
枚举两个点,而且还过(0,0)点,所以直接计算出所有的圆心,并用map保存
#include<bits/stdc++.h> using namespace std; const int MAXN=2005; int n,ans; double a[MAXN],b[MAXN],x,y; typedef pair<double,double> p; map<p,int> mx; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%lf%lf",a+i,b+i); for(int i=1;i<=n;i++) { mx.clear(); for(int j=i+1;j<=n;j++) if(a[i]*b[j]!=a[j]*b[i]) { x=((b[j]-b[i])*b[i]*b[j]-a[i]*a[i]*b[j]+a[j]*a[j]*b[i])/(a[j]*b[i]-a[i]*b[j]); y=((a[j]-a[i])*a[i]*a[j]-b[i]*b[i]*a[j]+b[j]*b[j]*a[i])/(b[j]*a[i]-b[i]*a[j]); mx[p(x,y)]++; ans=max(mx[p(x,y)],ans); } } printf("%d\n",ans+1); }