結果

問題 No.476 正しくない平均
ユーザー matsuyoshi30matsuyoshi30
提出日時 2017-03-06 22:24:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 508 bytes
コンパイル時間 2,051 ms
コンパイル使用メモリ 73,316 KB
実行使用メモリ 56,364 KB
最終ジャッジ日時 2023-09-05 16:02:25
合計ジャッジ時間 7,032 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,364 KB
testcase_01 AC 123 ms
56,060 KB
testcase_02 AC 123 ms
56,036 KB
testcase_03 AC 125 ms
55,844 KB
testcase_04 AC 123 ms
55,784 KB
testcase_05 AC 124 ms
56,180 KB
testcase_06 AC 125 ms
56,164 KB
testcase_07 AC 123 ms
55,808 KB
testcase_08 AC 123 ms
55,956 KB
testcase_09 AC 124 ms
55,784 KB
testcase_10 AC 123 ms
56,004 KB
testcase_11 AC 123 ms
55,768 KB
testcase_12 AC 123 ms
56,184 KB
testcase_13 AC 125 ms
56,172 KB
testcase_14 AC 122 ms
55,768 KB
testcase_15 AC 126 ms
55,880 KB
testcase_16 AC 125 ms
55,676 KB
testcase_17 AC 125 ms
55,900 KB
testcase_18 AC 124 ms
56,008 KB
testcase_19 AC 124 ms
55,832 KB
testcase_20 AC 126 ms
55,932 KB
testcase_21 AC 126 ms
56,080 KB
testcase_22 AC 125 ms
55,844 KB
testcase_23 AC 124 ms
56,116 KB
testcase_24 AC 124 ms
56,008 KB
testcase_25 AC 122 ms
55,504 KB
testcase_26 AC 123 ms
55,964 KB
testcase_27 AC 122 ms
55,736 KB
testcase_28 AC 124 ms
56,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long a = in.nextInt();
        long sum = 0;
        for(int i=0; i<n; i++) {
            sum += in.nextInt();
        }

        if(sum % n == 0 && sum / n == a) System.out.println("YES");
        else System.out.println("NO");

        in.close();
    }
}
0