1. R = R - r; Then You will solve problem with N points and a circle of radius R 2. Build 2 circles thru all pairs of points (it is n*(n-1) circles) and calculate amount of points in this circles. Maximum of them is the answer.
For example, you can consider isosceles triangle (two original points and center). You can also solve two equations: dist(p, p1) = r and dist(p, p2) = r in coordinats (but I think first way is simpler).
Fix one point on the circle. This point becomes the begin of coordinates. For each other point calculate interval of angles were center can be. Now that you have intervals on the circle and you have to find point which is covered by maximum number of intervals.
Your program compiles with no errors. I've also tried once to submit the program in C++ and got CE; rewrited in Delphi it got AC. Another program in C++ got WA, in Delphi - AC. Admins, fix please the bugs!
2. As for WA - there is no difference for the judge system which language you use. Your program on C++ is just wrong. If you are sure it is correct, contact with Vladimir Yakovlev ( you can find his mail on http://acm.timus.ru/author.aspx?id=17757 ).
const e=0.00001; var n,i,j,z,s,c:longint; r,r1,rx,ry,a,b,norm,w,l,x1,y1:real; x,y:array [1..100] of real; function check (x,y,r,x1,y1:real):boolean; begin if sqr (x-x1)+sqr (y-y1)<=sqr (r)+e then check:=true else check:=false; end; begin Read (n); for i:=1 to n do Read (x[i],y[i]); Read (r); Read (r1); r:=r-r1; if r<0 then begin write (0); halt; end; if r=0 then begin write (1); halt; end; if n=1 then begin write (1); halt; end; for i:=1 to n do for j:=i+1 to n do begin l:=sqr (x[i]-x[j]) + sqr (y[i]-y[j]); l:=l/4; if sqr(r)<l-e then break; l:=sqrt (l); w:=sqrt (sqr (r)-sqr (l)); x1:=(x[i]+x[j])/2; y1:=(y[i]+y[j])/2; a:=(y[i]-y[j]); b:=(x[j]-x[i]); norm:=sqrt (sqr(a)+sqr(b)); rx:=x1+a*w/norm; ry:=y1+b*w/norm; s:=2; for z:=1 to n do if (z<>i) and (z<>j) then if check (rx,ry,r,x[z],y[z]) then inc (s); if s>c then c:=s; a:=-(y[i]-y[j]); b:=-(x[j]-x[i]); norm:=sqrt (sqr(a)+sqr(b)); rx:=x1+a*w/norm; ry:=y1+b*w/norm; s:=2; for z:=1 to n do if (z<>i) and (z<>j) then if check (rx,ry,r,x[z],y[z]) then inc (s); if s>c then c:=s;
Hello. I had not red all you program-it is difficult,but i think you algorithm is bad,as for me i rassmatrival troiki to4ek,nahodil centr opis okrugnosti i t d. No odna tvoa o6ibka vidna-pri sravnenii vewestvennih 4isel ti usilivae6 neravenstvo, a ne oslabl`ae6: if sqr(r)<l-e then Nado:if sqr(r)<l+e then