結果

問題 No.476 正しくない平均
ユーザー samplelpmassamplelpmas
提出日時 2017-01-28 16:48:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 385 bytes
コンパイル時間 2,388 ms
コンパイル使用メモリ 71,872 KB
実行使用メモリ 56,576 KB
最終ジャッジ日時 2023-08-25 22:40:24
合計ジャッジ時間 6,842 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
53,944 KB
testcase_01 AC 102 ms
55,772 KB
testcase_02 AC 107 ms
56,020 KB
testcase_03 AC 105 ms
56,080 KB
testcase_04 AC 107 ms
55,696 KB
testcase_05 AC 105 ms
55,708 KB
testcase_06 AC 107 ms
56,056 KB
testcase_07 AC 110 ms
55,672 KB
testcase_08 AC 106 ms
56,576 KB
testcase_09 AC 103 ms
56,012 KB
testcase_10 AC 105 ms
55,744 KB
testcase_11 AC 106 ms
55,924 KB
testcase_12 AC 101 ms
55,876 KB
testcase_13 AC 105 ms
55,856 KB
testcase_14 AC 111 ms
56,096 KB
testcase_15 AC 106 ms
56,108 KB
testcase_16 AC 104 ms
55,804 KB
testcase_17 AC 105 ms
55,968 KB
testcase_18 AC 107 ms
55,812 KB
testcase_19 AC 106 ms
55,896 KB
testcase_20 AC 107 ms
55,848 KB
testcase_21 AC 102 ms
55,904 KB
testcase_22 AC 108 ms
56,164 KB
testcase_23 AC 104 ms
56,496 KB
testcase_24 AC 107 ms
55,856 KB
testcase_25 AC 108 ms
55,516 KB
testcase_26 AC 106 ms
56,000 KB
testcase_27 AC 105 ms
55,680 KB
testcase_28 AC 107 ms
56,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        long answer = sc.nextInt();

        long sum = 0;

        for (int i = 0; i < n; i++) {
            sum += sc.nextInt();
        }

        System.out.println(sum == answer * n ? "YES" : "NO");

    }

}
0