WA 5 pls. help me . thanks beforehand
import java.util.Scanner;
public class Problem_1348 {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int ax,ay,bx,by,cx,cy,l;
double ac,bc,ab,x,min,A,B,C,h;
x=h=0;
ax=in.nextInt();
ay=in.nextInt();
bx=in.nextInt();
by=in.nextInt();
cx=in.nextInt();
cy=in.nextInt();
l=in.nextInt();
ab= Math.sqrt( (bx-ax)*(bx-ax)+(by-ay)*(by-ay) );
ac =Math.sqrt( (cx-ax)*(cx-ax)+ (cy-ay)*(cy-ay) );
bc= Math.sqrt( (cx-bx)*(cx-bx) + (cy-by)*(cy-by) );
A=ac; B=bc; C=ab;
x=(A*A-B*B+C*C)/(2*C);
h= Math.sqrt((A*A-x*x));
min=h;
if(A>B){
if(min-l<0)System.out.printf("%.2f",0.00); else System.out.printf("%.2f",min-l);
System.out.println();
if(A-l<0)System.out.printf("%.2f",0.00);else System.out.printf("%.2f",A-l);
}else{
if(min-l<0)System.out.printf("%.2f",0.00); else System.out.printf("%.2f",min-l);
System.out.println();
if(A-l<0)System.out.printf("%.2f",0.00);else System.out.printf("%.2f",B-l);
}
}
}
Edited by author 06.05.2014 16:57
Re: WA 5 pls. help me . thanks beforehand
Если основание высоты не попадает в отрезок AB, то такого расстояния не хватит