def maximizeFishing(A): for i in range(len(A)): for j in range(len(A[0,:])): A[i][j] += max(0 if i < 1 else A[i - 1][j], 0 if j < 1 else A[i][j - 1]) return A[-1][-1]
时间: 2024-10-13 01:07:20
def maximizeFishing(A): for i in range(len(A)): for j in range(len(A[0,:])): A[i][j] += max(0 if i < 1 else A[i - 1][j], 0 if j < 1 else A[i][j - 1]) return A[-1][-1]