結果

問題 No.476 正しくない平均
ユーザー Grenache
提出日時 2017-01-27 22:22:31
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 725 bytes
コンパイル時間 3,145 ms
コンパイル使用メモリ 75,616 KB
実行使用メモリ 41,628 KB
最終ジャッジ日時 2024-12-24 09:42:21
合計ジャッジ時間 7,625 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

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


public class Main_yukicoder476 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();
		long a = sc.nextInt();

		long sum = 0;
		int[] x = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();

			sum += x[i];
		}

		if (a * n == sum) {
			pr.println("YES");
		} else {
			pr.println("NO");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0