結果

問題 No.476 正しくない平均
ユーザー マサマサ
提出日時 2022-02-09 16:33:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 412 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 72,040 KB
実行使用メモリ 56,364 KB
最終ジャッジ日時 2023-09-07 01:49:09
合計ジャッジ時間 7,373 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,008 KB
testcase_01 AC 121 ms
54,012 KB
testcase_02 AC 122 ms
55,580 KB
testcase_03 AC 119 ms
56,060 KB
testcase_04 AC 120 ms
56,188 KB
testcase_05 AC 124 ms
56,000 KB
testcase_06 AC 121 ms
55,896 KB
testcase_07 AC 121 ms
56,068 KB
testcase_08 AC 121 ms
55,832 KB
testcase_09 AC 125 ms
55,924 KB
testcase_10 AC 123 ms
55,896 KB
testcase_11 AC 123 ms
56,028 KB
testcase_12 AC 125 ms
55,920 KB
testcase_13 AC 124 ms
56,228 KB
testcase_14 AC 123 ms
55,996 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 124 ms
55,696 KB
testcase_19 AC 125 ms
55,684 KB
testcase_20 AC 126 ms
55,988 KB
testcase_21 WA -
testcase_22 AC 120 ms
55,548 KB
testcase_23 AC 121 ms
56,128 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 124 ms
56,364 KB
testcase_27 WA -
testcase_28 AC 121 ms
55,580 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();
		int sample = sc.nextInt();
		
		int sum = 0;
		for (int i = 0; i < n; i++) {
			sum += sc.nextInt();
		}
		
		double avg = (double)sum / n;
		
		if (avg == sample) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		sc.close();
	}
}
0