1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "maklib.h"
#include "message.h"
#include <iostream>

using namespace std;
typedef long long int64;

int main(int argc,char**argv)
{
  int _size = Size();
  int64 sum;
  int64 _max = 0;  
  
  for(int i = 1 ; i <= _size ; ++i)
  {
    sum += ElementAt(i);
    if(sum > _max)
      _max = sum;
    if(sum < 0) sum = 0;
     
  }
if(!MyNodeId())
cout << _max;
}