#include using namespace std; const int N = 200010; const int INF = 0x3f3f3f3f; int n, a[N], res = -INF; int sum[N]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; //输入 sum[i] = sum[i - 1] + a[i]; //记录前缀和 } for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) res = max(res, sum[j] - sum[i - 1]); cout << res << endl; return 0; }