結果

問題 No.476 正しくない平均
コンテスト
ユーザー fkwnw3_1243
提出日時 2017-05-04 08:39:02
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 738 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,759 ms
コンパイル使用メモリ 80,576 KB
実行使用メモリ 39,260 KB
最終ジャッジ日時 2026-04-04 10:50:22
合計ジャッジ時間 3,591 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] inputs = reader.readLine().split(" ");
        int n = Integer.parseInt(inputs[0]);
        long a = Long.parseLong(inputs[1]);
        inputs = reader.readLine().split(" ");
        long sum = 0;
        for (int i = 0; i < n; i++) {
            sum += Long.parseLong(inputs[i]);
        }
        if((a*n) == sum) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
0