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 1075. Thread in a Space

WA#4 - I don't know why
Posted by Leonid (SLenik) Andrievskiy 2 Aug 2009 13:36
AB, AC, BC - Vectors.
r - Radius.
Arctangent(y, x) - Coprocessor function FPATAN, calculates an angle between vectors A(x, y) and X(1, 0)(using y and x coordinates of the A point).

My algorithm:

d = Abs(VectorMultiply(AC, BC)) / AB
if (d >= r) then Write(Length(AB))
else begin
    s1 = Sqrt(Length(AC) * Length(AC) - r * r)
    angle1 = Arctangent(Sqrt(Length(AC) * Length(AC) -
             d * d), d) - Arctangent(s1, r);
    s2 = Sqrt(Length(BC) * Length(BC) - r * r)
    angle2 = Arctangent(Sqrt(Length(BC) * Length(BC) -
             d * d), d) - Arctangent(s2, r);
    s = r * (angle1 + angle2)
    Write(s1 + s + s2)
end

-----

Am I wrong?
Re: WA#4 - I don't know why
Posted by Anatoly 18 Sep 2009 19:19
I think if you'll get following test, then you'll get 4th.

1 2 0
3 3 0
0 0 0
2

The answer is 2.24 (not 2.30)
Re: WA#4 - I don't know why
Posted by Sirko 30 Jul 2013 22:44
Thank's Anatoly, that helped me. Don't know, how I've missed this :)