結果

問題 No.1823 Tricolor Dango
ユーザー tentententen
提出日時 2022-01-31 16:25:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 241 ms / 2,000 ms
コード長 1,428 bytes
コンパイル時間 2,425 ms
コンパイル使用メモリ 74,952 KB
実行使用メモリ 60,260 KB
最終ジャッジ日時 2023-09-02 02:18:45
合計ジャッジ時間 8,856 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,872 KB
testcase_01 AC 189 ms
55,076 KB
testcase_02 AC 176 ms
54,876 KB
testcase_03 AC 178 ms
55,104 KB
testcase_04 AC 164 ms
56,964 KB
testcase_05 AC 166 ms
56,824 KB
testcase_06 AC 164 ms
57,148 KB
testcase_07 AC 164 ms
56,672 KB
testcase_08 AC 159 ms
57,080 KB
testcase_09 AC 165 ms
56,832 KB
testcase_10 AC 166 ms
56,832 KB
testcase_11 AC 168 ms
56,996 KB
testcase_12 AC 157 ms
56,816 KB
testcase_13 AC 163 ms
54,476 KB
testcase_14 AC 177 ms
55,100 KB
testcase_15 AC 162 ms
54,440 KB
testcase_16 AC 137 ms
54,624 KB
testcase_17 AC 143 ms
54,504 KB
testcase_18 AC 167 ms
55,228 KB
testcase_19 AC 241 ms
60,260 KB
testcase_20 AC 169 ms
55,320 KB
testcase_21 AC 172 ms
55,508 KB
testcase_22 AC 189 ms
55,108 KB
testcase_23 AC 167 ms
56,944 KB
testcase_24 AC 178 ms
57,904 KB
testcase_25 AC 183 ms
54,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int t = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        while (t-- > 0) {
            int n = sc.nextInt();
            long total = 0;
            int max = 0;
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                total += x;
                max = Math.max(max, x);
            }
            if (total % 3 == 0 && total / 3 >= max) {
                sb.append("Yes");
            } else {
                sb.append("No");
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0