結果
| 問題 |
No.476 正しくない平均
|
| ユーザー |
soi09476291
|
| 提出日時 | 2019-11-24 08:21:02 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 925 bytes |
| コンパイル時間 | 764 ms |
| コンパイル使用メモリ | 110,208 KB |
| 実行使用メモリ | 26,400 KB |
| 最終ジャッジ日時 | 2024-10-12 04:15:02 |
| 合計ジャッジ時間 | 2,358 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.
ソースコード
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");
}
}
}
}
soi09476291