-
//zoj1041 Transmitters
-
//Accepted 1041 C ++ 00:00.00 424K
-
#include <stdio.h>
-
#include <math.h>
-
#define MAXN 1000
-
struct point {double x,y;}c;
-
double r;
-
double xmult(double x1,double y1,double x2,double y2){return x1*y2-x2*y1;}
-
double dist(point p1,point p2){ return sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));}
-
-
void solve()
-
{
-
int i,j,n,num,max,cnt;
-
double dx,dy,dt;
-
point pt,p[MAXN];
-
scanf ("%d",&n);
-
num = 0;
-
for (i=0; i<n; ++i) {
-
scanf ("%lf %lf",&pt.x,&pt.y);
-
if (dist(pt,c)<=r) p[num++] = pt;
-
}
-
if (num<=2){
-
printf ("%d/n",num);
-
return ;
-
}
-
max = 2;
-
for (i=0; i<num; ++i){
-
cnt = 1;
-
dy = p[i].y-c.y;
-
dx = p[i].x-c.x;
-
for (j=0; j<num; ++j){
-
if (i==j) continue;
-
if (xmult(p[j].x-c.x,p[j].y-c.y,dx,dy)>=0.0) cnt++;
-
}
-
if (cnt>max) max = cnt;
-
}
-
printf ("%d/n",max);
-
}
-
-
int main()
-
{
-
#ifdef ONLINE_JUDGE
-
#else
-
freopen("1041.txt","r",stdin);
-
#endif
-
while (scanf("%lf %lf %lf",&c.x,&c.y,&r)!=EOF){
-
if (r<=0.0) break;
-
solve();
-
}
-
#ifdef ONLINE_JUDGE
-
#else
-
fclose(stdin);
-
#endif
-
return 0;
-
}
zoj1041 Transmitters
最新推荐文章于 2018-12-29 19:48:43 发布