1 #include <iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<cmath> 5 #include<map> 6 #include<algorithm> 7 using namespace std; 8 typedef long long ll; 9 const int MAXN=1e4+10; 10 int m,n; 11 int str[100001]; 12 int dp[100001]; 13 int main() 14 { 15 cin>>m; 16 for(int i=0;i<m;i++) 17 { 18 cin>>str[i]; 19 } 20 dp[0]=str[0]; 21 int ans=dp[0]; 22 for(int i=1;i<m;i++) 23 { 24 dp[i]=max(dp[i],dp[i-1]+str[i]); 25 ans=max(ans,dp[i]); 26 } 27 cout<<ans<<endl; 28 return 0; 29 }