結果

問題 No.1823 Tricolor Dango
ユーザー Asahi
提出日時 2023-02-05 06:32:47
言語 Java
(openjdk 23)
結果
AC  
実行時間 711 ms / 2,000 ms
コード長 888 bytes
コンパイル時間 1,998 ms
コンパイル使用メモリ 74,412 KB
実行使用メモリ 56,764 KB
最終ジャッジ日時 2024-07-03 23:17:33
合計ジャッジ時間 18,240 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
// import java.math.*;
// import java.util.stream.Stream;

class Main{
    static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static PrintWriter output = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    
    public static void main(String[] args) throws IOException{
        int T = sc.nextInt();
        while(T-->0) {
            int n = sc.nextInt();
            long [] A = new long[n];
            long sum = 0;
            long max = -1;
            for(int i=0;i<n;i++) {
                A[i] = sc.nextLong();
                sum += A[i];
                max = Math.max(max,A[i]);
            }
            if(sum % 3 == 0 && max <= sum/3) output.println("Yes");
            else output.println("No");
        }
        output.flush();
    }
}
0