ural 1052 Rabbit Hunt

    技术2024-11-05  25

    枚举每两个点.

    #include<iostream> using namespace std; const int MAXN=200; int n,m; int x[MAXN]; int y[MAXN]; int main() { int i,j,k,dy,dx,count; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d%d",&x[i],&y[i]); for(i=0;i<n;i++) for(j=0;j<i;j++) { dy=y[j]-y[i]; dx=x[j]-x[i]; count=0; for(k=0;k<n;k++) if(y[k]*dx==dy*(x[k]-x[i])+dx*y[i]) count++; if(count>m) m=count; } printf("%d/n",m); return 0; }

    最新回复(0)