测评机: Xeost[5]
得分: 85分
提交日期: 2010-9-30 8:12:00
有效耗时: 953毫秒
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时62ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时47ms
测试结果5: 通过本测试点|有效耗时47ms
测试结果6: 通过本测试点|有效耗时47ms
测试结果7: 通过本测试点|有效耗时47ms
测试结果8: 通过本测试点|有效耗时46ms
测试结果9: 测试结果错误.错误结果为:23
正确结果应为:26
测试结果10: 测试结果错误.错误结果为:3
正确结果应为:8
测试结果11: 通过本测试点|有效耗时47ms
测试结果12: 通过本测试点|有效耗时47ms
测试结果13: 通过本测试点|有效耗时47ms
测试结果14: 测试结果错误.错误结果为:4
正确结果应为:5
测试结果15: 通过本测试点|有效耗时62ms
测试结果16: 通过本测试点|有效耗时47ms
测试结果17: 通过本测试点|有效耗时47ms
测试结果18: 通过本测试点|有效耗时47ms
测试结果19: 通过本测试点|有效耗时47ms
测试结果20: 通过本测试点|有效耗时47ms
const dx:array[1..3]of integer=(0,-1,0);
dy:array[1..3]of integer=(-1,0,1);
var i,j,n,t,tot,max,x,y:integer;
s:string;
a,b:array[1..10,1..10]of integer;
procedure find(m,x1,y1:integer);
var i:integer;
begin
if t=tot then begin writeln(t);halt;end;
if m>n then begin if tot>max then max:=tot;end
else
for i:=1 to 3 do
if (x1+dx[i]>0)and(y1+dy[i]>0)and(y1+dy[i]<10) then
if (b[x1+dx[i],y1+dy[i]]<>1) then
begin
x1:=x1+dx[i];y1:=y1+dy[i];
if a[x1,y1]=1 then inc(tot);
if tot>max then max:=tot;
b[x1,y1]:=1;
find(m+1,x1,y1);
b[x1,y1]:=0;
if a[x1,y1]=1 then dec(tot);
x1:=x1-dx[i];y1:=y1-dy[i];
end;
end;
begin
readln(n);
for i:=1 to 5 do
begin
readln(s);
for j:=1 to 9 do
begin
if s[j]='K' then
begin a[i,j]:=1;if x=0 then inc(t);end;
if s[j]='L' then
begin a[i,j]:=2;x:=i;y:=j;end;
end;
end;
find(1,x,y);
writeln(max);
end.