結果

問題 No.476 正しくない平均
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-13 11:44:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 2,132 ms
コンパイル使用メモリ 74,376 KB
実行使用メモリ 41,568 KB
最終ジャッジ日時 2024-04-28 17:25:04
合計ジャッジ時間 7,182 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
40,144 KB
testcase_01 AC 130 ms
41,072 KB
testcase_02 AC 135 ms
41,404 KB
testcase_03 AC 132 ms
41,456 KB
testcase_04 AC 129 ms
41,292 KB
testcase_05 AC 132 ms
41,388 KB
testcase_06 AC 121 ms
39,772 KB
testcase_07 AC 131 ms
41,160 KB
testcase_08 AC 130 ms
41,280 KB
testcase_09 AC 124 ms
39,876 KB
testcase_10 AC 139 ms
41,480 KB
testcase_11 AC 137 ms
41,392 KB
testcase_12 AC 143 ms
41,388 KB
testcase_13 AC 138 ms
41,208 KB
testcase_14 AC 137 ms
41,496 KB
testcase_15 AC 132 ms
41,364 KB
testcase_16 AC 134 ms
41,372 KB
testcase_17 AC 138 ms
41,500 KB
testcase_18 AC 138 ms
41,324 KB
testcase_19 AC 139 ms
41,228 KB
testcase_20 AC 139 ms
41,164 KB
testcase_21 AC 137 ms
41,168 KB
testcase_22 AC 135 ms
41,484 KB
testcase_23 AC 136 ms
41,200 KB
testcase_24 AC 141 ms
41,568 KB
testcase_25 AC 141 ms
41,400 KB
testcase_26 AC 139 ms
41,336 KB
testcase_27 AC 137 ms
41,160 KB
testcase_28 AC 140 ms
41,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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];
		for(int i = 0 ; i < n ; i++) x[i] = sc.nextInt();
		long ans = 0;
		for(int i = 0 ; i < n ; i++) {
			ans += x[i];
		}
		if(ans == a * n) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}
0