結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
oemon
|
| 提出日時 | 2016-11-23 18:07:37 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 523 bytes |
| コンパイル時間 | 874 ms |
| コンパイル使用メモリ | 106,368 KB |
| 実行使用メモリ | 20,608 KB |
| 最終ジャッジ日時 | 2024-11-27 10:19:55 |
| 合計ジャッジ時間 | 3,160 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 23 WA * 14 RE * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Linq;
namespace No275
{
class Program
{
static void Main(string[] args)
{
var N = int.Parse(Console.ReadLine());
var As = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
var ordered = As.OrderBy(a => a).ToArray();
var result = N % 2 == 0
? new[] { ordered[N / 2 - 1], ordered[N / 2] }.Average()
: ordered[N / 2 - 1];
Console.Write(result);
}
}
}
oemon