|  | 
|  | 
| вернуться в форум | WA#1 Why? I pass the given tests correctly.
 BTW, the problem can have several answers, :S
Re: WA#1 I had WA#1, then WA#22. Can somebody help me? I think there are problems with precision.Re: WA#1 Wow, I also have WA#22 now.
 BTW, my WA#1 was because I didn't #include <math.h> LOL
Re: WA#1 AC now)))Using epsilon in some more places helped me a lot!
Re: WA#1 Послано Chiffa  25 окт 2008 18:02According formule S=sqrt(p*(p-a)*(p-b)*(p-c)) => the problem has 3 different answers.Re: WA#1 No! Sample #2 has only one answer.Re: WA#1 Послано svr  26 окт 2008 09:52Yes!Agree.Impossible get Ac without eps.Epsilon Please, who can explain me why epsilon is needed inproblems which contain real numbers, and where should
 I use it in this problem? I got WA#22, and can't
 understand my mistake.
Re: Epsilon Послано svr  27 окт 2008 09:44There are many trick with epsilon.For example. Let eps=1e-10 and some geometrical
 value d calculated as -1.e-11. We reject this
 calculation because d must be >=0 and make mistake
 lossing d=0. With eps we do it as
 if (fabs(d)<=eps) d=0
 thus accepting negative -1e-11.
Re: Epsilon When I used eps=1e-13, I got WA #22, and when I chaged it to 1e-10, I got AC.
 Here are fragments, where I use eps:
 
 ...
 double d=p*p-2*a*b;
 if(fabs(d)<eps)
 ...
 (d is discriminant of square equation)
 
 ...
 if(t1>a+eps || t2>b+eps)
 return false;
 ...
 (check that t1<=a and t2<=b).
 
 I can't understand why I had this situation.
Re: Epsilon Maybe the numbers are big, so adding 1e-13 is equal to adding 0.Re: Epsilon eps = 1e-10thanks!
 
 Edited by author 30.07.2011 02:06
 
 Edited by author 30.07.2011 02:06
 | 
 | 
|