摘要: 思路:max_sum 设为极小值,用来存最大子段和。current_sum 设为 0,存当前子段和。对每个元素 num,更新 current_sum 为 max(num, current_sum + num)。这意味着要么以 num 开始新子段,要么把 num 加入当前子段,取和更大的情况。再用 m 阅读全文
posted @ 2025-02-16 22:19 1inkin_sub 阅读(10) 评论(0) 推荐(0)