|  | 
|  | 
| вернуться в форум | Please could you look at my prog please. Послано Nurbek  15 янв 2006 00:14I've solved this problem but still have WA on test 3.Could you give me this test or find my mistake plz.
 var
 l,k,j:integer;
 d,d1,d2,m,b:real; t:boolean;
 x,y,x1,y1,x2,y2:integer;
 label con;
 begin
 read(x1,y1,x2,y2,x,y,l);
 if (((x>=x1)and(x<=x2))or((y>=y1)and(y<=y2)))or
 (((x<=x1)and(x>=x2))or((y<=y1)and(y>=y2))) then
 begin
 if x2-x1>0 then m:=(y2-y1)/(x2-x1)
 else m:=0;
 b:=y1-m*x1;
 if y=m*x+b then begin d:=0; goto con;end;
 if ((m=0)and(y1=y2))or((m=0)and(x1=x2)) then
 begin
 if y1=y2 then d:=abs(y1-y);
 if x1=x2 then d:=abs(x1-x);
 end
 else d:=abs(m*x+b-y)/sqrt(m*m);
 con:if d-l>0 then writeln((d-l):0:2)
 else writeln((1.00-1.00):0:2);
 d1:=sqrt(sqr(x-x1)+sqr(y-y1));
 d2:=sqrt(sqr(x-x2)+sqr(y-y2));
 if (d1>=d2)and(d1-l>=0) then
 begin writeln((d1-l):0:2); t:=true;end;
 if (d2>d1)and(d2-l>0) then
 begin writeln((d2-l):0:2); t:=true;end;
 if t=false then write((1.00-1.00):0:2);
 t:=false;
 halt;
 end;
 d1:=sqrt(sqr(x-x1)+sqr(y-y1));
 d2:=sqrt(sqr(x-x2)+sqr(y-y2));
 if (d1>=d2)and(d2-l>=0) then writeln((d2-l):0:2);
 if (d1<d2)and(d1-l>0) then writeln((d1-l):0:2);
 if (d1>=d2)and(d1-l>=0) then writeln((d1-l):0:2) ;
 if (d1<d2)and(d2-l>0) then writeln((d2-l):0:2) ;
 end.
 | 
 | 
|