题目描述
摘花生
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
python动态规划 代码
T=int(input())
N=110
w=[[] for _ in range(N)]
f=[[0 for _ in range(N)] for _ in range(N)]
while T>0:
T=T-1
n,m=map(int,input().split())
w[0]=[0 for i in range(m+1)]
for i in range(1,n+1):
w[i]=list(map(int,input().split()))
w[i].insert(0,0)
print(w)
for i in range(1,n+1):
for j in range(1,m+1):
f[i][j]=10000
f[i][j]=max(f[i][j-1],f[i-1][j])+w[i][j]
print(f[n][m])