package test;
import java.util.Scanner;
public class pratice {
private static Scanner in;
public static void main(String[] args) {
in = new Scanner(System.in);
int line ;
long b = 0, c = 0,d = 0;
while (in.hasNext()) {
int[] num = new int[in.nextInt()];
for(int a:num){
num[a] = in.nextInt() ;
if(num[a] % 3 ==0){
b++;
}else if(num[a] % 3 ==1){
c++;
}else if(num[a] % 3 ==2){
d++;
}
}
System.out.println(b+" "+ c +" "+ d);
}
}
}
import java.util.Scanner; public class Rayark{ public static void main(String []args){ Scanner maimai = new Scanner(System.in); int c1=0; int c2 =0; int c3 =0; int m =maimai.nextInt(); while(m!=0){ int u=m%3; switch(u) { case 0: c2++; break; case 1: c1++; break; case 2: c3++; break; } m --; } System.out.println(c1+" "+c2+" "+c3); } }
這樣寫也可以