結果

問題 No.476 正しくない平均
ユーザー マサ
提出日時 2022-02-09 16:35:46
言語 Java
(openjdk 23)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 2,246 ms
コンパイル使用メモリ 74,236 KB
実行使用メモリ 41,560 KB
最終ジャッジ日時 2024-06-24 20:29:24
合計ジャッジ時間 6,822 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long sample = sc.nextInt();
		
		long sum = 0;
		for (long 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