We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
DP
枚举所有左上角为(1,1),右下角为(x,y)的矩形。 可以举例证明,(x,y)只能运输到上面或者左边,不可以不运输。
因此可以得到状态转移方程f(x,y) = max{f(x-1,y)+SUM_A(x,y), f(x,y-1)+SUM_B(x,y)}。 (SUM_A(x,y)等于A(x,y)运送到左边,一路上A(x,1)~A(x,y)的总和,SUM_B(x,y)同理)