結果

問題 No.476 正しくない平均
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-13 11:44:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 1,866 ms
コンパイル使用メモリ 70,944 KB
実行使用メモリ 56,240 KB
最終ジャッジ日時 2023-08-11 00:15:48
合計ジャッジ時間 6,624 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,872 KB
testcase_01 AC 118 ms
56,104 KB
testcase_02 AC 120 ms
56,032 KB
testcase_03 AC 117 ms
55,848 KB
testcase_04 AC 119 ms
55,928 KB
testcase_05 AC 117 ms
56,240 KB
testcase_06 AC 117 ms
56,156 KB
testcase_07 AC 117 ms
56,044 KB
testcase_08 AC 115 ms
55,552 KB
testcase_09 AC 116 ms
55,584 KB
testcase_10 AC 117 ms
55,536 KB
testcase_11 AC 120 ms
56,012 KB
testcase_12 AC 121 ms
55,292 KB
testcase_13 AC 124 ms
55,356 KB
testcase_14 AC 124 ms
55,516 KB
testcase_15 AC 123 ms
55,564 KB
testcase_16 AC 120 ms
55,600 KB
testcase_17 AC 122 ms
55,684 KB
testcase_18 AC 123 ms
55,376 KB
testcase_19 AC 121 ms
56,004 KB
testcase_20 AC 120 ms
55,308 KB
testcase_21 AC 120 ms
55,940 KB
testcase_22 AC 121 ms
56,144 KB
testcase_23 AC 125 ms
55,348 KB
testcase_24 AC 120 ms
55,944 KB
testcase_25 AC 118 ms
56,008 KB
testcase_26 AC 118 ms
56,008 KB
testcase_27 AC 118 ms
55,700 KB
testcase_28 AC 117 ms
55,680 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