|
|
back to boardWA#9 Posted by RASTA 18 Mar 2009 22:19 const eps = 1e-9; var a1, b1, a2, b2, x, y, x1, y1, d, x2, y2: real; i, n: longint; Begin read(d, x1, y1, x2, y2); read(n); a1 := y1; b1 := -x1; a2 := y2; b2 := -x2; for i := 1 to n do begin read(x, y); if (abs(x1 - x2) < eps) and (abs(y1 - y2) < eps) then begin if (abs(a1 * x + b1 * y) < eps) and (x * x + y * y - eps <= d * d) and (abs(sqrt(x * x + y * y) + sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)) - sqrt(x1 * x1 + y1 * y1)) < eps) then writeln('YES') else writeln('NO') end else if (a1 * x + b1 * y - eps <= 0) and (a2 * x + b2 * y + eps >= 0) and (x * x + y * y - eps <= d * d) then writeln('YES') else writeln('NO'); end; End. I solve this problem with type longint but it makes no difference... Re: WA#9 try this: 5 1 0 1 0 1 -1 0 corect is NO ...and it is more useful to use Longint instead of real to solve this problem. To compare distances use sqr of distances Re: WA#9 Posted by MAK 17 Feb 2010 11:36 This test helped me 5 0 1 0 1 1 0 1 correct answer: YES Re: thank you very much TUSUR lxn!!! Posted by hoan 5 Dec 2010 23:23 Re: WA#9 This test helped me: 1007 20 25 4 5 1 -16 -20 Answer : NO Edited by author 14.11.2012 21:28 |
|
|