Type: Default 1000ms 256MiB

最大子段和

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

给定一个长度为 n 的整数序列,您的任务是查找连续的非空子数组中值的最大总和。

输入格式

第一行输入一个整数 n,表示序列的长度。

接下来一行 n 个整数,第i个整数为aia_i,表示读入的序列元素。

输出格式

输出一个整数,表示序列的最大子段和。

样例输入

5
-5 3 -1 3 2

样例输出

7

提示

  • 1n21051\leq n \leq 2·10^5
  • 109ai109-10^9\leq a_i \leq 10^9

1月第三周昆十中教研

Not Claimed
Status
Done
Problem
14
Open Since
2026-1-12 0:00
Deadline
2026-1-19 23:59
Extension
24 hour(s)