結果

問題 No.476 正しくない平均
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-02 01:17:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 782 bytes
コンパイル時間 3,379 ms
コンパイル使用メモリ 74,480 KB
実行使用メモリ 50,548 KB
最終ジャッジ日時 2024-04-27 17:39:24
合計ジャッジ時間 5,014 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
50,276 KB
testcase_01 AC 46 ms
50,092 KB
testcase_02 AC 49 ms
50,520 KB
testcase_03 AC 46 ms
50,312 KB
testcase_04 AC 47 ms
50,340 KB
testcase_05 AC 47 ms
50,088 KB
testcase_06 AC 47 ms
50,224 KB
testcase_07 AC 46 ms
50,328 KB
testcase_08 AC 46 ms
50,124 KB
testcase_09 AC 46 ms
49,960 KB
testcase_10 AC 46 ms
50,244 KB
testcase_11 AC 46 ms
50,228 KB
testcase_12 AC 45 ms
50,548 KB
testcase_13 AC 45 ms
50,128 KB
testcase_14 AC 49 ms
50,128 KB
testcase_15 AC 47 ms
50,176 KB
testcase_16 AC 46 ms
50,416 KB
testcase_17 AC 47 ms
50,092 KB
testcase_18 AC 47 ms
50,220 KB
testcase_19 AC 47 ms
50,316 KB
testcase_20 AC 45 ms
50,064 KB
testcase_21 AC 46 ms
50,256 KB
testcase_22 AC 47 ms
50,436 KB
testcase_23 AC 46 ms
50,464 KB
testcase_24 AC 46 ms
50,220 KB
testcase_25 AC 45 ms
50,496 KB
testcase_26 AC 49 ms
50,068 KB
testcase_27 AC 49 ms
50,184 KB
testcase_28 AC 48 ms
50,420 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