1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include "maklib.h"
#include <stdio.h>

int main() {
  long max = 0, sum = 0;
  long i, elem;
  for (i=1; i <= Size(); i ++){
  	elem = ElementAt(i);
     sum = sum + (long)elem;
     if(sum < 0) sum = 0;
     if(sum > max) max = sum; 
  }
  printf("%d\n", max);
  return 0;
}