結果

問題 No.476 正しくない平均
ユーザー 37zigen37zigen
提出日時 2017-01-28 01:32:22
言語 Java19
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 3,982 ms
コンパイル使用メモリ 72,340 KB
実行使用メモリ 56,424 KB
最終ジャッジ日時 2023-08-25 22:34:26
合計ジャッジ時間 7,275 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,500 KB
testcase_01 AC 120 ms
55,688 KB
testcase_02 AC 123 ms
56,148 KB
testcase_03 AC 120 ms
56,424 KB
testcase_04 AC 120 ms
55,348 KB
testcase_05 AC 122 ms
56,116 KB
testcase_06 AC 120 ms
55,632 KB
testcase_07 AC 121 ms
56,096 KB
testcase_08 AC 123 ms
56,280 KB
testcase_09 AC 123 ms
55,872 KB
testcase_10 AC 123 ms
55,960 KB
testcase_11 AC 121 ms
55,876 KB
testcase_12 AC 123 ms
55,644 KB
testcase_13 AC 125 ms
55,884 KB
testcase_14 AC 124 ms
55,852 KB
testcase_15 AC 126 ms
55,716 KB
testcase_16 AC 125 ms
56,020 KB
testcase_17 AC 123 ms
55,804 KB
testcase_18 AC 125 ms
55,612 KB
testcase_19 AC 125 ms
55,780 KB
testcase_20 AC 127 ms
55,640 KB
testcase_21 AC 126 ms
56,172 KB
testcase_22 AC 125 ms
56,188 KB
testcase_23 AC 124 ms
55,808 KB
testcase_24 AC 123 ms
55,824 KB
testcase_25 AC 123 ms
55,720 KB
testcase_26 AC 122 ms
55,680 KB
testcase_27 AC 121 ms
55,544 KB
testcase_28 AC 123 ms
55,736 KB
権限があれば一括ダウンロードができます

ソースコード

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