結果

問題 No.476 正しくない平均
ユーザー yagi2yagi2
提出日時 2017-04-14 11:19:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 72,100 KB
実行使用メモリ 59,400 KB
最終ジャッジ日時 2023-09-25 19:16:21
合計ジャッジ時間 6,640 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,516 KB
testcase_01 WA -
testcase_02 AC 120 ms
55,400 KB
testcase_03 AC 118 ms
55,596 KB
testcase_04 AC 118 ms
55,504 KB
testcase_05 WA -
testcase_06 AC 121 ms
55,848 KB
testcase_07 AC 119 ms
55,444 KB
testcase_08 AC 119 ms
55,800 KB
testcase_09 AC 119 ms
55,732 KB
testcase_10 AC 119 ms
55,968 KB
testcase_11 WA -
testcase_12 AC 118 ms
55,384 KB
testcase_13 AC 120 ms
57,664 KB
testcase_14 AC 121 ms
55,840 KB
testcase_15 AC 119 ms
55,516 KB
testcase_16 AC 121 ms
55,888 KB
testcase_17 AC 120 ms
55,756 KB
testcase_18 AC 122 ms
56,052 KB
testcase_19 AC 120 ms
55,872 KB
testcase_20 WA -
testcase_21 AC 119 ms
55,912 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 119 ms
55,464 KB
testcase_25 AC 119 ms
55,880 KB
testcase_26 WA -
testcase_27 AC 117 ms
55,432 KB
testcase_28 AC 118 ms
55,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.next());
        long A = Long.parseLong(sc.next());

        long sum = 0;
        for (int i = 0; i < N; i++) {
            sum += Long.parseLong(sc.next());
        }

        double avg = sum / N;

        if ((double)A == avg) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
0