• + 0 comments

    Scanner sc=new Scanner(System.in); int jum=sc.nextInt(); int jumtot=0; int count=0; int[] arrJum=new int[jum]; String test=""; for (int i = 0; i < jum; i++) { int val=sc.nextInt(); arrJum[i]=val;

        }
    
    
        for (int i = 0; i < arrJum.length; i++) {
            for (int j = i; j < arrJum.length; j++) {
                for (int j2 = i; j2 <= j; j2++) {
                    jumtot+=arrJum[j2];
    
                    test=test+String.valueOf(arrJum[j2]);
                }
                if(jumtot<0) count++;
                test="";
                jumtot=0;
    
            }
        }
    
        System.out.println(count);