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

using namespace std;

int main()
{
	int suma = ElementAt(1), akt = ElementAt(1);
	for (int i = 2; i <= Size(); ++i)
	{
		if (akt < 0) akt = ElementAt(i);
		else akt += ElementAt(i);
		if (akt > suma) suma = akt;
	}
	if (MyNodeId() == 0) cout << suma;
	return 0;
}