結果

問題 No.476 正しくない平均
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2017-01-27 23:47:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 2,088 ms
コンパイル使用メモリ 71,576 KB
実行使用メモリ 56,372 KB
最終ジャッジ日時 2023-08-25 22:34:08
合計ジャッジ時間 7,131 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,892 KB
testcase_01 AC 121 ms
55,576 KB
testcase_02 AC 127 ms
56,080 KB
testcase_03 AC 124 ms
56,160 KB
testcase_04 AC 124 ms
56,292 KB
testcase_05 AC 123 ms
56,080 KB
testcase_06 AC 124 ms
56,132 KB
testcase_07 AC 123 ms
55,880 KB
testcase_08 AC 123 ms
56,116 KB
testcase_09 AC 125 ms
56,372 KB
testcase_10 AC 125 ms
55,788 KB
testcase_11 AC 125 ms
55,824 KB
testcase_12 AC 126 ms
55,916 KB
testcase_13 AC 126 ms
56,276 KB
testcase_14 AC 127 ms
56,112 KB
testcase_15 AC 125 ms
55,980 KB
testcase_16 AC 125 ms
56,084 KB
testcase_17 AC 123 ms
55,528 KB
testcase_18 AC 124 ms
56,144 KB
testcase_19 AC 121 ms
55,532 KB
testcase_20 AC 125 ms
56,120 KB
testcase_21 AC 125 ms
56,216 KB
testcase_22 AC 127 ms
56,040 KB
testcase_23 AC 125 ms
55,820 KB
testcase_24 AC 124 ms
55,848 KB
testcase_25 AC 123 ms
56,224 KB
testcase_26 AC 122 ms
55,816 KB
testcase_27 AC 122 ms
56,324 KB
testcase_28 AC 122 ms
56,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static long mod = (long)Math.pow(10,6);
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = sc.nextInt();
        long sum=0;
        for(int i=0; i<N; i++){
            int tmp = sc.nextInt();
            sum+=tmp;
        }
        double ave = sum/(double)N;
        if(ave==a){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}
0