https://www.acmicpc.net/problem/1912
#include <iostream>
using namespace std;
const int MAX = 100000;
int arr[MAX+1] ={0, };
int dp[MAX+1] ={0, };
int n;
int solution(){
int answer = arr[1];
for(int i=1;i<=n;i++){
dp[i] = max(dp[i-1] + arr[i], arr[i]);
answer = max(answer, dp[i]);
}
return answer;
}
#include<iostream>
using namespace std;
int main() {
int N,max=-1000;
cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
cin>>N;
for(int i=0,t=0,b;i<N;i++){
cin>>b;
b=t+b>b?t+b:b;
max=max<b?b:max;
t=b;
}
cout<<max;
}