不大会写记忆化,各种不蛋定……
const wx:array[1..4]of longint=(1,-1,0,0); wy:array[1..4]of longint=(0,0,1,-1);var ans,i,j,r,c:longint; a,f:array[0..100,0..100]of longint; visit:array[0..100,0..100]of boolean;procedure dfs(x,y:longint);var nx,ny,i:longint;begin visit[x,y]:=true; for i:=1 to 4 do begin nx:=x+wx[i]; ny:=y+wy[i]; if (nx>=1)and(ny>=1)and(nx<=c)and(ny<=r)and(a[nx,ny] ans then ans:=f[j,i]; writeln(ans);end.