a,b,c,d,j,x,k,big,small:longint;
min,ls,ls1,ls2,min1,min2:double;
begin
readln(a,b,c,d);
if a>c then begin big:=a;small:=c; end
else begin big:=c;small:=a; end;
min1:=maxlongint;
min2:=min1;
min:=min2;
for x:=small to big do
begin
for j:=-1 to 1 do
if j<>0 then
for k:=1 to 99 do
begin
ls1:=abs(a+j*(x+k/100));
ls2:=abs(c+j*(x+k/100));
if (ls1<min) or (ls2<min) then
begin
ls:=sqrt(sqr(ls1)+b)+sqrt(sqr(ls2)+d);
if ls<min then
begin
min:=ls;
min1:=ls1;
min2:=ls2;
end;
end;
end;
end;
writeln(min:0:3);
end.
--------------------------------------------------
以上是我噁心的枚舉.
比賽時精度太大,竟然2個超時.
把精度改小就AC了.
--------------------------------------------------
状态题目:火炬手之梦
题目编号:238-火炬手之梦
状态: Accepted
测评机: Xeost[5]
得分: 100分
提交日期: 2008-8-7 22:40:00
有效耗时: 1016毫秒
测试结果1: 通过本测试点|有效耗时63:ms
测试结果2: 通过本测试点|有效耗时250:ms
测试结果3: 通过本测试点|有效耗时47:ms
测试结果4: 通过本测试点|有效耗时46:ms
测试结果5: 通过本测试点|有效耗时62:ms
测试结果6: 通过本测试点|有效耗时78:ms
测试结果7: 通过本测试点|有效耗时250:ms
测试结果8: 通过本测试点|有效耗时47:ms
测试结果9: 通过本测试点|有效耗时94:ms
测试结果10: 通过本测试点|有效耗时79:ms
{$APPTYPE CONSOLE}
var
a, b, c, d, ans: extended;
begin
readln(a, b, c, d);
b := - sqrt(b);
d := sqrt(d);
ans := sqrt(sqr(b - d) + sqr(a - c));
writeln(ans:0:3)
end.
var a,c,x1,x2,x3,ymin:real;
b,d,y1,y2,y3:real;
begin
read(a,b,c,d);
b:=sqrt(b);d:=sqrt(d);
x1:=-a;y1:=b;
x2:=-c;y2:=d;
x3:=-a;y3:=-b;
ymin:=0;
if ((y1>0) and (y2<0)) or ((y1<0) and (y2>0))
then ymin:=sqrt(sqr(x1-x2)+sqr(y1-y2))
else ymin:=sqrt(sqr(x2-x3)+sqr(y2-y3));
write(ymin:0:3);
end.
测评机: Xeond[6]
得分: 100分
提交日期: 2008-8-8 14:27:00
有效耗时: 515毫秒
测试结果1: 通过本测试点|有效耗时62:ms
测试结果2: 通过本测试点|有效耗时47:ms
测试结果3: 通过本测试点|有效耗时47:ms
测试结果4: 通过本测试点|有效耗时47:ms
测试结果5: 通过本测试点|有效耗时78:ms
测试结果6: 通过本测试点|有效耗时47:ms
测试结果7: 通过本测试点|有效耗时47:ms
测试结果8: 通过本测试点|有效耗时47:ms
测试结果9: 通过本测试点|有效耗时46:ms
测试结果10: 通过本测试点|有效耗时47:ms