@@ -0,0 +1,587 @@
+import java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A  public static void main(String%5B%5D args) %7B%0A    Scanner sc = new Scanner(System.in);%0A%0A    int size = sc.nextInt();%0A    int%5B%5D arr = new int%5Bsize%5D;%0A    for (int i = 0; i %3C size; i++) %7B%0A      arr%5Bi%5D = sc.nextInt();%0A    %7D%0A%0A    int count = 0;%0A    for (int i = 0; i %3C size; i++) %7B%0A      int sum = 0;%0A      for (int j = i; j %3C size; j++) %7B%0A        sum += arr%5Bj%5D;%0A        if (sum %3C 0) %7B%0A          count++;%0A        %7D%0A      %7D%0A    %7D%0A    System.out.println(count);%0A  %7D%0A%7D%0A

solve java 1d array