PersonalCorpus 版 (精华区)
41691 2002-10-15 01:17:09 Accepted
1041 C++ 00:00.01 392K Big Guava
double distance(double a, double b, double c, double d)
{
return sqrt((a-c)*(a-c)+(b-d)*(b-d));
}
double multi(double a, double b, double c, double d, double e, double
f)
{
return (a-e)*(d-f)-(c-e)*(b-f);
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\0acm\\zju\\i1041","r",stdin);
freopen("c:\\0acm\\zju\\o1041","w",stdout);
#endif
int i,j,k,n,x,y,p[150][2],a,b,best;
double r,t;
while (1) {
scanf("%d%d%lf\n",&x,&y,&r);
if (r<0) break;
scanf("%d\n",&n);
i=0;
while (n--) {
scanf("%d%d\n",&a,&b);
if (distance(a,b,x,y)<=r) {
p[i][0]=a;
p[i][1]=b;
i++;
}
}
n=i; best=0;
for (i=0;i<n;i++) {
a=0; b=0;
for (j=0;j<n;j++) {
t=multi(p[i][0],p[i][1],p[j][0],p[j][1],x,y);
if (t>=0) a++;
if (t<=0) b++;
}
if (a>best) best=a;
if (b>best) best=b;
}
printf("%d\n",best);
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.867毫秒