讨论 / 哪里错了
Fish、のTorres 2009-08-02 14:31:00
点我顶贴 收藏 删除
Rt。。。

var a:array[1..100,1..4]of integer;

n,i,j,k,t:longint;

s,x:double;

begin

readln(n);

for i:=1 to n do begin

read(a[i,1],a[i,2],a[i,3],a[i,4]);

if a[i,1]>a[i,3] then begin

t:=a[i,1];a[i,1]:=a[i,3];a[i,3]:=t;

end;

if a[i,2]>a[i,4] then begin

t:=a[i,2];a[i,2]:=a[i,4];a[i,4]:=t;

end;

end;

x:=100000000;

for i:=0 to 100 do begin

for j:=0 to 100 do begin

s:=0;

for k:=1 to n do begin

t:=0;

if a[k,1]=a[k,3] then begin

if (j>=a[k,2]) and (j<=a[k,4]) then begin

s:=s+abs(i-a[k,1]);

end

else begin

if abs(j-a[k,4])>abs(j-a[k,2]) then t:=j-a[k,2] else t:=j-a[k,4];

s:=s+sqrt((i-a[k,1])*(i-a[k,1])+t*t);

end;

end

else begin

if (i>=a[k,1]) and (i<=a[k,3]) then begin

s:=s+abs(j-a[k,2]);

end

else begin

if abs(i-a[k,1])>abs(i-a[k,3]) then t:=i-a[k,3] else t:=i-a[k,1];

s:=s+sqrt((j-a[k,2])*(j-a[k,2])+t*t);

end;

end;

end;

if s<x then x:=s;

end;

end;

write(x:0:2);

end.

#1 Fish、のTorres@2009-08-02 14:31:00
回复 删除
up
查看更多回复
提交回复