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
28
29
#include "kanapka.h"
#include "message.h"

#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
    long long wyn = 0;

    long long w = 0;
    long long suma=0;
    for (long long i = 0; i <GetN(); i++)
    {
      if (w < 0)
        w += GetTaste(i);
      else
        w = GetTaste(i);
      if (w < wyn)
        wyn = w;
        suma=suma+GetTaste(i);
    }

    cout<<suma-wyn;
   return 0;

}