双脚不能动的滑雪叫什么式
- 提问者网友:温旧梦泪无声
- 2021-03-19 13:53
就是不能前后移动 两脚只能一起动的那种
- 五星知识达人网友:三千妖杀
- 2021-03-19 14:38
- 1楼网友:蕴藏春秋
- 2021-03-19 17:42
这是标程,你的思路差不多,比对一下就知道哪里错了
program phx;
var i,j,temp,n,m,max1:longint;
data,f:array [1..100,1..100] of longint;
function max(a,b:longint):longint;
begin
if a>b then exit(a)
else exit(b);
end;
function dp(i,j:longint):longint;
var l1,l2,l3,l4:longint;
begin
if f[i,j]<>maxlongint
then exit(f[i,j]);
l1:=1;
l2:=1;
l3:=1;
l4:=1;
if (i<>n) and (data[i+1,j]<data[i,j])
then l1:=l1+dp(i+1,j);
if (j<>m) and (data[i,j+1]<data[i,j])
then l2:=l2+dp(i,j+1);
if (i<>1) and (data[i-1,j]<data[i,j])
then l3:=l3+dp(i-1,j);
if (j<>1) and (data[i,j-1]<data[i,j])
then l4:=l4+dp(i,j-1);
f[i,j]:=max(max(l1,l2),max(l3,l4));
exit(f[i,j]);
end;
begin
readln(n,m);
for i:=1 to n do
for j:=1 to m do
begin
read(data[i,j]);
f[i,j]:=maxlongint;
end;
max1:=-maxlongint;
for i:=1 to n do
for j:=1 to m do
begin
temp:=dp(i,j);
if temp>max1 then
max1:=temp;
end;
writeln(max1);
end.
- 2楼网友:西风乍起
- 2021-03-19 16:20
- 3楼网友:雾月
- 2021-03-19 16:06