#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int n;
    cin >> n;
    
    int currsum = -1;
    int maxsum  = -1;
    
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        
        currsum = max(x, x+currsum);
        maxsum  = max(maxsum, currsum);
    }
    
    cout << maxsum;
}
posted on 2016-12-04 10:57  yanhh  阅读(430)  评论(0编辑  收藏  举报