• + 0 comments
    import java.io.*;
    import java.util.*;
    
    public class Solution {
    
        public static void main(String[] args) {
            /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
            Scanner scan= new Scanner(System.in);
            int n=scan.nextInt();
            int[] a= new int[n];
            for(int i=0;i<n;i++){
                a[i]=scan.nextInt();
            }
            int count=0;
            for(int k=0;k<n;k++){
                for(int i=0,j=i+k;i<n && j<n;i++,j=i+k){
                    int sum=0;
                    for(int x=i;x<=j;x++){
                        sum+=a[x];
                    }
                    count=sum<0? count+1:count;
            }}
            System.out.println(count);
        }
    }