const
wq:array[1..4,1..2] of longint=((-1,0),(0,1),(1,0),(0,-1));
var
i,j,ans,tot:longint;
map:array[0..10,0..10]of longint;
s:array[0..999999]of boolean;
procedure prin(x,y,dep:longint);
var
i,x1,y1:longint;
begin
if dep=6 then begin
if not s[tot] then begin
inc(ans);
s[tot]:=true;
end;
end else for i:=1 to 4 do begin
x1:=x+wq[i,1];
y1:=y+wq[i,2];
if (x1>0) and (x1<=5) and (y1>0) and (y1<=5) then begin
tot:=tot*10+map[x1,y1];
prin(x1,y1,dep+1);
tot:=tot div 10;
end;
end;
end;
begin
for i:=1 to 5 do begin
for j:=1 to 5 do read(map[i,j]);
readln;
end;
ans:=0;
tot:=0;
for i:=1 to 5 do begin
for j:=1 to 5 do begin
tot:=tot*10+map[i,j];
prin(i,j,1);
tot:=0;
end;
end;
writeln(ans);
end.
想学 Pascal,就应该 看 Pascal 的代码
别人给你翻译成C ,难道你是想学 C 不成?
为什么要学pascal呢
帮你把上面的Pascal代码翻译成C++,对你学习Pascal没有什么帮助啊