링크 : https://www.acmicpc.net/problem/1912
#include <iostream>
#include <vector>
using namespace std;
int dp[100000];
int main(){
int N;
cin >> N;
vector<int> v;
for(int i = 0; i < N; i++){
int tmp;
cin >> tmp;
v.push_back(tmp);
}
dp[0] = v[0];
int result = dp[0];
for(int i = 1; i < N; i++){
dp[i] = max(dp[i-1] + v[i], v[i]);
result = max(result, dp[i]);
}
cout << result << '\n';
return 0;
}