結果

問題 No.476 正しくない平均
ユーザー soi09476291soi09476291
提出日時 2019-11-24 08:21:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 925 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 113,164 KB
実行使用メモリ 26,240 KB
最終ジャッジ日時 2024-04-20 08:52:03
合計ジャッジ時間 2,424 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
23,772 KB
testcase_01 AC 22 ms
26,112 KB
testcase_02 AC 21 ms
23,772 KB
testcase_03 AC 22 ms
26,068 KB
testcase_04 AC 21 ms
25,816 KB
testcase_05 AC 21 ms
23,900 KB
testcase_06 AC 20 ms
24,112 KB
testcase_07 AC 21 ms
25,948 KB
testcase_08 AC 21 ms
23,848 KB
testcase_09 AC 22 ms
24,112 KB
testcase_10 AC 21 ms
24,032 KB
testcase_11 AC 20 ms
26,016 KB
testcase_12 AC 22 ms
26,020 KB
testcase_13 AC 22 ms
23,972 KB
testcase_14 AC 22 ms
23,776 KB
testcase_15 AC 22 ms
24,032 KB
testcase_16 AC 22 ms
26,068 KB
testcase_17 AC 22 ms
23,776 KB
testcase_18 AC 23 ms
26,240 KB
testcase_19 AC 22 ms
24,160 KB
testcase_20 AC 22 ms
24,164 KB
testcase_21 AC 21 ms
24,152 KB
testcase_22 AC 21 ms
26,024 KB
testcase_23 AC 21 ms
24,160 KB
testcase_24 AC 20 ms
26,148 KB
testcase_25 AC 22 ms
25,944 KB
testcase_26 AC 21 ms
24,100 KB
testcase_27 AC 22 ms
24,028 KB
testcase_28 AC 22 ms
26,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Text;
using System.Linq;

namespace ConsoleApp11
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal average = 0;
            long sum = 0;

            var input = Console.ReadLine().Trim().Split(' ');
            var input1 = Console.ReadLine().Split(' ');

            long n = long.Parse(input[0]);
            long a = long.Parse(input[1]);

            long[] x = new long[n];

            for(int i = 0; i < n; i++)
            {
                x[i] = long.Parse(input1[i]);
            }

            for(long i = 0; i < n; i++)
            {
                sum += x[i];
            }

            average = (decimal)sum / x.Length;

            if(average == a)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }        
    }
}
0