讨论 / "运行错误|普通保护错误" 怎么改???
hchx 2013-07-05 06:18:00
点我顶贴 收藏 删除
状态: Unaccepted

测评机: Xeond[6]

得分: 0分

提交日期: 2013-7-5 21:16:00

有效耗时: 该状态没有记录

测试结果1: 运行错误|普通保护错误

测试结果2: 运行错误|普通保护错误

测试结果3: 运行错误|普通保护错误

测试结果4: 运行错误|普通保护错误

测试结果5: 运行错误|普通保护错误

测试结果6: 运行错误|普通保护错误

测试结果7: 运行错误|普通保护错误

测试结果8: 运行错误|普通保护错误

测试结果9: 运行错误|普通保护错误

测试结果10: 运行错误|普通保护错误

#1 hchx@2013-07-05 06:18:00
回复 删除
这是我的程序

type node=record

s:string;

k:integer;

end;

var b:array [1..10000] of node;

s:string;

t,w,i,j,x,y,k:integer;

f,flag:boolean;

c:char;

begin

t:=1;

w:=1;

readln(b[t].s);

b[t].k:=0;

f:=false;

while not(f) do

begin

for i:=1 to 3 do

for j:=1 to 3 do

if b[t].s[(i-1)*3+j]='0' then

begin

x:=i;

y:=j;

end;

if x<>1 then

begin

s:=b[t].s;

c:=s[(x-1)*3+y];

s[(x-1)*3+y]:=s[(x-2)*3+y];

s[(x-2)*3+y]:=c;

flag:=true;

for i:=1 to w do

if s=b[i].s then

begin

flag:=false;

break;

end;

if flag then

begin

inc(w);

b[w].s:=s;

b[w].k:=b[t].k+1;

if b[w].s='123804765' then

begin

writeln(b[w].k);

halt;

end;

end;

end;

if x<>3 then

begin

s:=b[t].s;

c:=s[(x-1)*3+y];

s[(x-1)*3+y]:=s[x*3+y];

s[x*3+y]:=c;

flag:=true;

for i:=1 to w do

if s=b[i].s then

begin

flag:=false;

break;

end;

if flag then

begin

inc(w);

b[w].s:=s;

b[w].k:=b[t].k+1;

if b[w].s='123804765' then

begin

writeln(b[w].k);

halt;

end;

end;

end;

if y<>1 then

begin

s:=b[t].s;

c:=s[(x-1)*3+y];

s[(x-1)*3+y]:=s[(x-1)*3+y-1];

s[(x-1)*3+y-1]:=c;

flag:=true;

for i:=1 to w do

if s=b[i].s then

begin

flag:=false;

break;

end;

if flag then

begin

inc(w);

b[w].s:=s;

b[w].k:=b[t].k+1;

if b[w].s='123804765' then

begin

writeln(b[w].k);

halt;

end;

end;

end;

if y<>3 then

begin

s:=b[t].s;

c:=s[(x-1)*3+y];

s[(x-1)*3+y]:=s[(x-1)*3+y+1];

s[(x-1)*3+y+1]:=c;

flag:=true;

for i:=1 to w do

if s=b[i].s then

begin

flag:=false;

break;

end;

if flag then

begin

inc(w);

b[w].s:=s;

b[w].k:=b[t].k+1;

if b[w].s='123804765' then

begin

writeln(b[w].k);

halt;

end;

end;

end;

t:=t+1;

end;

end.

查看更多回复
提交回复