|
|
back to boardWhy I can't pass the 7'th test? Posted by Pavel 12 Apr 2008 18:57 Hello. My solution gets WA on then 7'th test. I can't realize, why it does. my algorithm: find the described rectangle (x1,y1,x2,y2) if abs((x2-x1)-(y2-y1))>3 then it is triangle;exit; if abs((x2-x1)-(y2-y1))=0 then check if is rectangle; if it's so, then exit; here I have a figure (triangle or circle) that is described with "nearly" square. I allow that the circle can be described not with a square (because of roundings). I calculate the area of the figure. Then:
if area>5/8*sqr(((x2-x1+1)+(y2-y1+1))/2) then it is circle else it is triangle the final decision is based on this: For example, triangle in described with a square with side = A. Then it's area ranges from 0 (not including) to sqr(A)/2 (including). The circle with diameter=A have area that is nearly equal to PI/4*sqr(A). The number 5/8 lies between 1/2 and PI/4. why does my solution not get AC? Edited by author 12.04.2008 21:08 |
|
|