|
|
вернуться в форумSome Help Don't forget to use abs.. It really gave me some headaches why I receive WA#2 :) Re: Some Help yes,yes=) thank you) But now i got WA#3 =( whats wrong? program lam; var xa,ya,xb,yb,xc,yc,ab,bc,ac,res,sk1,sk2,l,max,min: real; begin read(xa,ya,xb,yb,xc,yc,l); ab:=sqrt(sqr(xa-xb)+sqr(ya-yb)); ac:=sqrt(sqr(xa-xc)+sqr(ya-yc)); bc:=sqrt(sqr(xc-xb)+sqr(yc-yb)); sk1:=((xc-xb)*(xa-xb)+(yc-yb)*(ya-yb)); sk2:=((xc-xa)*(xb-xa)+(yc-ya)*(yb-ya)); if ab=0 then begin if l>ac then begin writeln('0.00'); writeln('0.00'); end else begin writeln((ac-l):0:2); writeln((ac-l):0:2); end; halt; end; if (sk1>0) and (sk2>0) then begin res:=abs((abs(xc-xb)*abs(ya-yb)-abs(xa-xb)*abs(yc-yb)))/ab; if l>res then writeln('0.00') else writeln((res-l):0:2); if bc>ac then max:=bc else max:=ac; if l>max then writeln('0.00') else writeln((max-l):0:2); end; if (sk1<0) or (sk2<0) then begin if bc>ac then begin max:=bc; min:=ac; end else begin max:=ac; min:=bc; end; if l>min then writeln('0.00') else writeln((min-l):0:2); if l>max then writeln('0.00') else writeln((max-l):0:2); end; if (sk1=0) or (sk2=0) then begin res:=(abs(xc-xb)*abs(ya-yb)-abs(xa-xb)*abs(yc-yb))/ab; if l>res then writeln('0.00') else writeln((res-l):0:2); if bc=res then if l>ac then writeln('0.00') else writeln((ac-l):0:2); if ac=res then if l>bc then writeln('0.00') else writeln((bc-l):0:2); end; end. Edited by author 13.03.2009 20:01 |
|
|