|
|
back to boardds:=sqr(b)-a*c; the checking must look like this if ds+0.000000000001>=0 then ... 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... 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? 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. 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. Is negative time a possible answer? :( 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. I also checked abs(ds) < eps , then t = -b/(2*a) Without it, it was WA3 |
|
|