ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1600. Airport

If you got WA#3 or WA#16
Posted by kolesnik_av 24 Mar 2008 23:20
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
Posted by Olympic Bear (Nikolay Dubchuk) 10 Jun 2008 17:36
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
Posted by yujj 13 Jun 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
Posted by Hadi Moshayedi 24 Jul 2008 15:18
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
Posted by Denis Koshman 19 Aug 2008 04:14
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
Posted by Linas 19 Oct 2008 22:40
Is negative time a possible answer? :(
Re: If you got WA#3 or WA#16
Posted by Azrail 1 Dec 2008 14:14
There is curious fact, that you can get AC with eps = .1!
Most important do not forget about:
Hadi Moshayedi wrote 24 July 2008 15:18
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
Posted by Felix_Mate 30 Aug 2015 20:40
Thanks!
Re: If you got WA#3 or WA#16
Posted by Mortus 24 Jul 2023 18:06
I also checked abs(ds) < eps , then t = -b/(2*a)

Without it, it was WA3