|
|
back to boardWA 13..Is it a precision problem? Posted by maksay 22 Oct 2008 17:55 I get WA 13 again and again and I can not find a mistake. My main logic looks like this: for(j=0;j<n;j++) {l=(x[j]-X)*(x[j]-X)+(y[j]-Y)*(y[j]-Y)+(z[j]-Z)*(z[j]-Z); if (l-D<1e-10) D=l;} printf("%0.6f\n",acos((2-D)/2.0)*r); I believe it is correct..So can anybody help me with finding a bug, please? Does anyone have a same problem? Re: WA 13..Is it a precision problem? I had exactly this kind of problem. WA13. then I wrote: double tmp= (2 - minL)/2.0; tmp-=0.00000000001; if (tmp<-1) tmp=-1; return r*Math.acos(tmp); and AC. It is problem with precision, of course. Re: WA 13..Is it a precision problem? What is D ? |
|
|