- 拯救ice-cream
- 2009-01-11 19:46:07 @
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案错误...程序输出比正确答案长
---|---|---|---|---|---|---|---|-
Unaccepted 有效得分:80 有效耗时:0ms
const
aa:array[1..4,1..2] of integer=((1,0),(-1,0),(0,1),(0,-1));
var
ff,gg,t,n,m,i,j,ii,jj,oi,oj:longint;
a:array[1..25,1..25] of char;
dd:array[1..25,1..25] of longint;
pi,pj:array[1..10000] of longint;
tt:array[1..25,1..25] of boolean;
begin
assign(input,'1.txt');
reset(input);
readln(t);
readln(n);
readln(m);
for i:=1 to m do
begin
for j:=1 to n do
begin
read(a);
if a='s'
then begin
pi[1]:=i;
pj[1]:=j;
end;
if a='m'
then begin
oi:=i;
oj:=j;
end;
end;
readln;
end;
a[oi,oj]:='.';
fillchar(tt,sizeof(tt),false);
fillchar(dd,sizeof(dd),0);
tt[pi[1],pj[1]]:=true;
ii:=0; jj:=1;
repeat
inc(ii);
for i:=1 to 4 do
begin
ff:=pi[ii]+aa;
gg:=pj[ii]+aa;
if (ff>0)and(gg>0)and(ffdd[pi[ii],pj[ii]]+1)or(dd[ff,gg]=0)
then dd[ff,gg]:=dd[pi[ii],pj[ii]]+1;
tt[ff,gg]:=true;
inc(jj);
pi[jj]:=ff;
pj[jj]:=gg;
end
end;
end;
end;
until ii>=jj;
if dd[oi,oj]>t
then writeln('55555')
else writeln(dd[oi,oj]);
end.
1 条评论
-
monocofe LV 8 @ 2009-07-16 15:00:44
同LZ
我也是一样的错..估计是输出了55555,答案是70.
- 1