結果

問題 No.476 正しくない平均
ユーザー matsuyoshi30matsuyoshi30
提出日時 2017-03-06 22:20:54
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 3,967 ms
コンパイル使用メモリ 72,000 KB
実行使用メモリ 57,852 KB
最終ジャッジ日時 2023-09-05 16:01:02
合計ジャッジ時間 7,638 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,712 KB
testcase_01 AC 124 ms
56,012 KB
testcase_02 AC 126 ms
55,664 KB
testcase_03 AC 123 ms
55,832 KB
testcase_04 AC 126 ms
55,836 KB
testcase_05 AC 125 ms
55,720 KB
testcase_06 AC 125 ms
55,724 KB
testcase_07 AC 124 ms
55,436 KB
testcase_08 AC 125 ms
55,380 KB
testcase_09 AC 126 ms
56,152 KB
testcase_10 AC 126 ms
55,796 KB
testcase_11 AC 125 ms
55,420 KB
testcase_12 AC 125 ms
55,720 KB
testcase_13 AC 127 ms
55,780 KB
testcase_14 AC 126 ms
56,016 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 128 ms
56,156 KB
testcase_19 AC 125 ms
56,120 KB
testcase_20 AC 124 ms
55,972 KB
testcase_21 WA -
testcase_22 AC 125 ms
56,068 KB
testcase_23 AC 125 ms
55,620 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 122 ms
55,900 KB
testcase_27 WA -
testcase_28 AC 124 ms
55,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int a = in.nextInt();
        int sum = 0;
        for(int i=0; i<n; i++) {
            sum += in.nextInt();
        }

        double ave = (double)sum / (double)n;
        if(ave == a) System.out.println("YES");
        else System.out.println("NO");

        in.close();
    }
}
0