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

Crash (FLT_INVALID_OPERATION) 17 test
Posted by Виктор Крупко 1 Apr 2005 02:28
{$n+}
program kaz;
  var
  l,x,x1,x2,y,y1,y2,st1,st2,st3,rast,ydl,per,h,opr:extended;
begin
    read(x1);
    read(y1);
    read(x2);
    readln(y2);
    read(x);
    read(y);
    read(l);
    st1:=sqrt(sqr(x1-x)+sqr(y1-y));
    st2:=sqrt(sqr(x2-x)+sqr(y2-y));
    st3:=sqrt(sqr(x2-x1)+sqr(y2-y1));
    per:=(st1+st2+st3)/2;
    h:=sqrt(per)*sqrt(per-st1)*sqrt(per-st2)*sqrt(per-st3)*2/st3;
    opr:=sqrt(st1*st1-h*h)+sqrt(st2*st2-h*h)-0.00001;
    if opr<st3 then ydl:=h-l
    else
    if st1<st2 then ydl:=st1-l
    else ydl:=st2-l;
    if st1>st2 then rast:=st1-l
    else rast:=st2-l;
    if rast<0 then  rast:=0;
    if ydl<0 then  ydl:=0;
    writeln(ydl:1:2);
    writeln(rast:1:2);
end.
Re: Crash (FLT_INVALID_OPERATION) 17 test
Posted by Burunduk1 1 Apr 2005 03:33
st3 can be equal to zero.
I changed your code: if st3=0 then h:=st1 else ...
And I've got AC!
thank you!!!!!!!!!!!!
Posted by Виктор Крупко 1 Apr 2005 03:48
 I am very happy.