Please help me, look over my code, I'll be thankfull to anyone who will find mistake in my code, or give me some tests. var h,s,aa,bb:real; a:array[1..3,1..2] of integer; i,l:integer; procedure readdata; begin readln(a[1,1],a[1,2],a[2,1],a[2,2]); readln(a[3,1],a[3,2],l); end; procedure writedata; begin writeln(aa:0:2); writeln(bb:0:2); end; function d(x1,y1,x2,y2:integer):real; begin d:=sqrt(sqr(x1-x2)+sqr(y1-y2)); end; procedure square; var p,a1,a2,a3:real; begin a1:=d(a[1,1],a[1,2],a[2,1],a[2,2]); a2:=d(a[3,1],a[3,2],a[2,1],a[2,2]); a3:=d(a[1,1],a[1,2],a[3,1],a[3,2]); p:=(a1+a2+a3)/2; s:=sqrt(p*(p-a1)*(p-a2)*(p-a2)); end; begin readdata; square; h:=d(a[1,1],a[1,2],a[2,1],a[2,2]); aa:=s/(0.5*h); if d(a[1,1],a[1,2],a[3,1],a[3,2])<aa then aa:=d(a[1,1],a[1,2],a[3,1],a[3,2]); if d(a[2,1],a[2,2],a[3,1],a[3,2])<aa then aa:=d(a[2,1],a[2,2],a[3,1],a[3,2]); bb:=d(a[3,1],a[3,2],a[2,1],a[2,2]); if d(a[3,1],a[3,2],a[1,1],a[1,2])>bb then bb:=d(a[3,1],a[3,2],a[1,1],a[1,2]); if (s/(0.5*h))>bb then bb:=(s/(0.5*h)); aa:=aa-l; bb:=bb-l; writedata; end. 2 1 4 2 0 0 1 YOUR: -1.00???? 3.47 AC: 1.24 3.47 What do you think how it can be changed? :):):):):):):):):):):):):):):)+++++++++++++++++++++ I'm not talking about decision, decision is right. I said that how code can be changed to get AC? I modified my code, it gives correct answer for your test but i still get this ****** WA#4 !!! Here is code var a1,a2,a3,h,s,aa,bb:real; a:array[1..3,1..2] of integer; i,l:integer; procedure readdata; begin reset(input);} readln(a[1,1],a[1,2],a[2,1],a[2,2]); readln(a[3,1],a[3,2],l); end; procedure writedata; begin writeln(aa:0:2); writeln(bb:0:2); end; function d(x1,y1,x2,y2:integer):real; begin d:=sqrt(sqr(x1-x2)+sqr(y1-y2)); end; procedure square; var p:real; begin a1:=d(a[1,1],a[1,2],a[2,1],a[2,2]); a2:=d(a[3,1],a[3,2],a[2,1],a[2,2]); a3:=d(a[1,1],a[1,2],a[3,1],a[3,2]); p:=(a1+a2+a3)/2; s:=sqrt(p*(p-a1)*(p-a2)*(p-a2)); end; begin readdata; square; if (a1*a1+a2*a2<a3*a3) or (a2*a2+a3*a3<a1*a1) or (a1*a1+a3*a3<a2*a2) then begin aa:=d(a[1,1],a[1,2],a[3,1],a[3,2]); if d(a[2,1],a[2,2],a[3,1],a[3,2])<aa then aa:=d(a[2,1],a[2,2],a[3,1],a[3,2]); end else begin h:=d(a[1,1],a[1,2],a[2,1],a[2,2]); aa:=s/(0.5*h); end; bb:=d(a[3,1],a[3,2],a[2,1],a[2,2]); if d(a[3,1],a[3,2],a[1,1],a[1,2])>bb then bb:=d(a[3,1],a[3,2],a[1,1],a[1,2]); aa:=aa-l; bb:=bb-l; writedata; end. Seems correct but gets WA#4 aa always >=0 bb always >=0 Before an input in procedure write make terms that was not aa <0 and bb <0 Maybe I'm Error,But,What mistake you think?I can not to found any mistake At a conclusion check up that aa and bb were not negative, If they will be negative appropriate him 0. Spaces and line feeds can follow each other in any order, so you need only to Read([1,1],a[1,2],a[2,1],a[2,2],a[3,1],a[3,2],l); -5 0 5 0 0 5 100 Correct answer is 0.00 0.00 |