백준 #2547번 사탕 선생 고창영

jhj·2024년 3월 14일

백준 JAVA

목록 보기
451/583
import java.util.Scanner;
import java.math.BigInteger;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int t = sc.nextInt();
		
		for(int i = 0; i < t; i++) {
			BigInteger total = BigInteger.valueOf(0);
			int a = sc.nextInt();
			
			for(int j = 0; j < a; j++) {
				BigInteger b = sc.nextBigInteger();
				total = total.add(b);
			}
			
			if(total.remainder(BigInteger.valueOf(a)).equals(BigInteger.valueOf(0))) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글