讨论 / why?
996760929 2009-01-11 18:22:00
点我顶贴 收藏 删除
状态: Unaccepted

测评机: Xeost[5]

得分: 80分

提交日期: 2009-1-12 10:13:00

有效耗时: 1251毫秒

测试结果1: 通过本测试点|有效耗时172:ms

测试结果2: 通过本测试点|有效耗时172:ms

测试结果3: 通过本测试点|有效耗时172:ms

测试结果4: 通过本测试点|有效耗时47:ms

测试结果5: 输出过少|用户输出数据少于标准输出的50%[标准输出10位|选手输出4位]

测试结果6: 通过本测试点|有效耗时172:ms

测试结果7: 通过本测试点|有效耗时172:ms

测试结果8: 通过本测试点|有效耗时172:ms

测试结果9: 通过本测试点|有效耗时172:ms

测试结果10: 输出过少|用户输出数据少于标准输出的50%[标准输出10位|选手输出4位]

提交代码: const

s1:array[1..4]of integer=(0,1,0,-1);

s2:array[1..4]of integer=(1,0,-1,0);

var

x,y,num:array[1..10000]of longint;

a:array[1..2000,1..2000]of longint;

b:array[1..2000,1..2000]of boolean;

s,t,im,jm,xm,ym,n,m,l,r,i,j,k:longint;

begin

readln(n,m);

for i:=1 to n do

begin

for j:=1 to m do

read(a[i,j]);

readln;

end;

fillchar(b,sizeof(b),true);

readln(xm,ym);

readln(im,jm);

l:=1;r:=1;

x[l]:=xm;

y[l]:=ym;

num[l]:=0;

b[xm,ym]:=false;

repeat

for i:=1 to 4 do

begin

s:=x[l]+s1[i];

t:=y[l]+s2[i];

if (s=im)and(t=jm) then begin

writeln(num[l]+1);

halt;

end;

if (s>=0)and(s<=2000)and(t>=0)and(t<2000)and(a[s,t]<>1)and(b[s,t])then begin

inc(r);

x[r]:=s;

y[r]:=t;

b[s,t]:=false;

num[r]:=num[l]+1;

end;

end;

inc(l);

if (x[r]=im)and(y[r]=jm) then begin writeln(num[r]);halt;end;

until l>r;

writeln(’No Answer!’);

end.

查看更多回复
提交回复