結果

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

ソースコード

diff #

import java.io.PrintWriter;
import java.util.*;
import java.util.concurrent.SynchronousQueue;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long a = sc.nextLong();
		long[] x = new long[n];
		long s = 0;
		for (int i = 0; i < n; ++i) {
			x[i] = sc.nextLong();
			s += x[i];
		}
		if (s % n != 0) {
			System.out.println("NO");
			return;
		}
		if (s / n == a) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0