|
|
вернуться в форумIf you got WA#3 or WA#16 ds:=sqr(b)-a*c; the checking must look like this if ds+0.000000000001>=0 then ... Re: If you got WA#3 or WA#16 Also when I calculated square roots for a*t^2 + 2*b*t + c = 0 as t1,2 = (-b +- sqrt(b^2 - a*c)) / a I had wa3. When I use b = 2.0 * b t1,2 = (-b +- sqrt(b^2 - 4.0*a*c)) / (2.0*a) I got AC. It is very curiously... Re: If you got WA#3 or WA#16 Послано yujj 13 июн 2008 15:05 I has WA#3. Even, i use check ds+0.000000000001>=0. I don't understand what's wrong. :( Can you talk me what in test 3? Re: If you got WA#3 or WA#16 If ds passes this test, it may be less than zero. so, if it is less than zero, reset it to zero. otherwise, sqrt won't perform as expected. Re: If you got WA#3 or WA#16 Also check for possible -0.000 replies (that happens in printf("%.3lf") when number is negative, but becomes zero after round-up). Some checkers do not like that. Re: If you got WA#3 or WA#16 Послано Linas 19 окт 2008 22:40 Is negative time a possible answer? :( Re: If you got WA#3 or WA#16 Послано Azrail 1 дек 2008 14:14 There is curious fact, that you can get AC with eps = .1! Most important do not forget about: If ds passes this test, it may be less than zero. so, if it is less than zero, reset it to zero. otherwise, sqrt won't perform as expected. Re: If you got WA#3 or WA#16 Thanks! Re: If you got WA#3 or WA#16 Послано Mortus 24 июл 2023 18:06 I also checked abs(ds) < eps , then t = -b/(2*a) Without it, it was WA3 |
|
|