#include<iostream>//灵光乍现,转移方程就写出来了
using namespace std;
int dp[200005],w[200005];
int n;
int main(){
cin >> n;
int i;
for(i = 1; i <= n; ++i)
{
cin >> w[i];
dp[i] = w[i];
}
for(i = 1; i <= n; ++i)
dp[i] = max(dp[i],dp[i-1]+w[i]);
int m = 1;
for(i = 1; i <= n; ++i)
if(dp[m] < dp[i])m = i;
cout << dp[m];
return 0;
}
07-11
08-26