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 1348. Goat in the Garden 2

Help me, pls
Posted by Romow Peter 6 Jul 2007 00:48
Please help to stupid goat.
My solution:

if AtSegm(A, B, CrossLine(PointsToLine(A, B), PerLine(PointsToLine(A, B), C)))
  then Writeln(NullOrNum(   Dist(CrossLine(PointsToLine(A, B), PerLine(PointsToLine(A, B), C)), C)    -len) : 0 : 2)
  else Writeln(NullOrNum(min(Dist(A, C), Dist(B, C))-len) : 0 : 2);

Writeln(NullOrNum(max(Dist(A, C), Dist(B, C))-len) : 0 : 2);

where
  AtSegm(A, B, C) - point locate on segment
  PerLine(L) - perpendicular of L
  NullOrNum(x) = max(0, x)
  Dist(A, B) - distantion between points A and B
  len - length of rope

Where may be bug?
Re: Help me, pls
Posted by awpris 6 Jul 2007 05:51
Here there should be still even one "else" ...