結果

問題 No.476 正しくない平均
ユーザー bellbell
提出日時 2021-02-20 17:47:21
言語 Java19
(openjdk 21)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 2,782 ms
コンパイル使用メモリ 74,228 KB
実行使用メモリ 57,796 KB
最終ジャッジ日時 2023-10-18 22:22:19
合計ジャッジ時間 7,402 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
57,560 KB
testcase_01 AC 143 ms
57,248 KB
testcase_02 AC 146 ms
57,264 KB
testcase_03 AC 139 ms
57,532 KB
testcase_04 AC 138 ms
57,696 KB
testcase_05 AC 138 ms
57,624 KB
testcase_06 AC 138 ms
57,200 KB
testcase_07 AC 140 ms
57,164 KB
testcase_08 AC 142 ms
57,712 KB
testcase_09 AC 138 ms
57,480 KB
testcase_10 AC 140 ms
57,560 KB
testcase_11 AC 141 ms
57,512 KB
testcase_12 AC 137 ms
57,364 KB
testcase_13 AC 141 ms
57,796 KB
testcase_14 AC 141 ms
57,596 KB
testcase_15 AC 140 ms
57,260 KB
testcase_16 AC 141 ms
57,664 KB
testcase_17 AC 141 ms
57,596 KB
testcase_18 AC 140 ms
57,564 KB
testcase_19 AC 142 ms
57,376 KB
testcase_20 AC 138 ms
57,188 KB
testcase_21 AC 140 ms
57,732 KB
testcase_22 AC 143 ms
57,332 KB
testcase_23 AC 145 ms
57,776 KB
testcase_24 AC 140 ms
57,752 KB
testcase_25 AC 138 ms
57,760 KB
testcase_26 AC 138 ms
57,232 KB
testcase_27 AC 140 ms
57,592 KB
testcase_28 AC 136 ms
57,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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