ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1331. Vladislava

WA 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?
Posted by Giorgi Giglemiani [Freeuni] 16 Oct 2013 15:47
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?
Posted by Ag'abek 4 Dec 2015 00:32
What is D ?