1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include "maklib.h"
#include "message.h"
#include <iostream>
using namespace std;

int main(){
    long long max1, max2;
    max1 = max2 =0;
    for (int i = 1; i < Size()+1 ; i += 1) {
        max2 = max2 + ElementAt(i);
        if (max2 < 0) {
            max2 = 0;
        } else if (max2 > max1) {
            max1 = max2;
        }
    }
	cout << max1 << endl;
  return 0;
}