結果

問題 No.476 正しくない平均
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-02 01:17:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 782 bytes
コンパイル時間 4,058 ms
コンパイル使用メモリ 71,796 KB
実行使用メモリ 51,376 KB
最終ジャッジ日時 2023-08-09 23:27:58
合計ジャッジ時間 6,611 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,256 KB
testcase_01 AC 44 ms
49,400 KB
testcase_02 AC 45 ms
49,404 KB
testcase_03 AC 44 ms
49,312 KB
testcase_04 AC 44 ms
49,588 KB
testcase_05 AC 45 ms
49,416 KB
testcase_06 AC 46 ms
49,492 KB
testcase_07 AC 44 ms
49,516 KB
testcase_08 AC 45 ms
49,612 KB
testcase_09 AC 44 ms
49,200 KB
testcase_10 AC 44 ms
49,240 KB
testcase_11 AC 45 ms
49,300 KB
testcase_12 AC 44 ms
49,304 KB
testcase_13 AC 44 ms
49,620 KB
testcase_14 AC 44 ms
49,572 KB
testcase_15 AC 45 ms
49,524 KB
testcase_16 AC 44 ms
49,408 KB
testcase_17 AC 44 ms
49,444 KB
testcase_18 AC 45 ms
49,564 KB
testcase_19 AC 44 ms
49,564 KB
testcase_20 AC 45 ms
51,376 KB
testcase_21 AC 45 ms
49,444 KB
testcase_22 AC 45 ms
49,280 KB
testcase_23 AC 45 ms
49,200 KB
testcase_24 AC 44 ms
49,248 KB
testcase_25 AC 45 ms
49,384 KB
testcase_26 AC 44 ms
49,380 KB
testcase_27 AC 43 ms
49,440 KB
testcase_28 AC 45 ms
49,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No476 {

	public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String[] str = br.readLine().split(" ");
			int N = Integer.parseInt(str[0]);
			double maiAns = Double.parseDouble(str[1]);
			String[] str2 = br.readLine().split(" ");
			long[] num = new long[N];
			long sum = 0;
			for(int i=0; i < N; i++){
				num[i] = Integer.parseInt(str2[i]);
				sum += num[i];
			}
			double ave = (double)sum / N;
			if(maiAns == ave) System.out.println("YES");
			else System.out.println("NO");
		}catch(IOException e){
			e.getStackTrace();
		}catch(NumberFormatException e){
			e.getStackTrace();
		}
	}

}
0