結果

問題 No.476 正しくない平均
コンテスト
ユーザー 大谷祐翔
提出日時 2025-11-10 16:54:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 110,712 KB
実行使用メモリ 26,664 KB
最終ジャッジ日時 2025-11-10 16:54:14
合計ジャッジ時間 3,215 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
class Program
{
    static void Main(string[] args)
    {
        string[] inputTop = Console.ReadLine()!.Split(' ');
        string[] inputBottom = Console.ReadLine()!.Split(' ');
        double total = double.Parse(inputTop[0]);
        double result = double.Parse(inputTop[1]);
        double sum = 0;

        for (int i = 0; i < inputBottom.Length; i++)
        {
            sum += int.Parse(inputBottom[i]);
        }

        double ans = sum / total;

        if (ans == result)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}
0