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-12-17 13:35:57
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]