cattle guest 之 fast hand

善变的同学

cattle guest 之 fast hand

cattle guest 之 fast hand

cattle guest 之 fast hand

cattle guest 之 fast hand

最大m子段和

cattle guest 之 fast hand

  • dp[i][j]
    • 抽取ii段啊!!必须要抽ii
    • 抽取前jj个数
    • 必须包含第j项
  • dp[i][j] 有两可能 (取较大那个)

cattle guest 之 fast hand

案例

  • -2, 11,-4, 13,-5, 6,-2
  • 求子段数 1.2.3…7时的结果。
  • 开二维数组,d [ M+1 ] [N + 1],初始化全0
    • M 是子段数,N是原始数据的长度

cattle guest 之 fast hand

  • 沃特玛声明一个dp[M+1][N]
    • 行我只用1,2.。。。M
    • 列我用0.1.。。。N-1

cattle guest 之 fast hand

cattle guest 之 fast hand

参考链接