結果

問題 No.476 正しくない平均
ユーザー マサ
提出日時 2022-02-09 16:33:12
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 412 bytes
コンパイル時間 3,002 ms
コンパイル使用メモリ 74,740 KB
実行使用メモリ 54,620 KB
最終ジャッジ日時 2024-06-24 20:26:24
合計ジャッジ時間 8,044 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 7
権限があれば一括ダウンロードができます

ソースコード

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