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

using namespace std;

int main()
{
    int suma = 0;
    int suma2 = 0;
    int maks = 0;

    for(unsigned long int i=0; i<Size(); i++)
    {
        if(suma > 0)
            suma += ElementAt(i+1);
        else
            suma = ElementAt(i+1);

        if(suma > maks)
            maks = suma;
    }


    cout <<  maks << endl;

    return 0;
}