Title Description
The semi-circular radar coverage with the center of the radar is multi-point radar rotatable to find the most covering number (including the boundary) sample input
25 25 3.5------radar coordinates and RADIUS
7----------points
25 28-------Point coordinates
23 27
27 27
24 23
26 23
24 29
26 29
350 200 2.0
5
350 202
350 199
350 198
348 200
352 200
995 995 10.0
4
1000 1000
999 998
990 992
1000 999
example output of 100-2.5 sample
3
4
4 Ideas
O (km^2)
first the radar range points with the Pythagorean theorem, and then each point and the center of the line as a diameter, calculate the left and right points, the number of points to be added to the diameter point.
var x,y:array[1..1000] of Longint;
n,a,b,c:double;
M,i,j,k,l,r,mid,max:longint;
Begin READLN (A,B,N);
While not EOF (input) does begin READLN (m); j:=0;
For I:=1 to M Do Begin Inc (J);
READLN (X[j],y[j]);
If sqrt (Sqr (a-x[j)) +sqr (B-y[j])) >n then Dec (j);
End
max:=0;
For I:=1 to J do begin mid:=0;l:=0;r:=0;
For K:=1 to J do begin c:= (y[k]-b) * (x[i]-a)-(x[k]-a) * (y[i]-b);
If C=0 then Inc (mid);
If C<0 then Inc (L);
If C>0 then Inc (R);
End
If L+mid>max then Max:=l+mid;
If R+mid>max then Max:=r+mid;
End
Writeln (max);
READLN (A,b,n);
End
End.