import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { //连续子数组的最大值 Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int [] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } int sum = arr[0]; for (int i = 1; i < n; i++) { arr[i] += Math.max(arr[i - 1], 0); sum = Math.max(sum, arr[i]); } System.out.println(sum); } }