結果

問題 No.275 中央値を求めよ
ユーザー oemonoemon
提出日時 2016-11-23 18:07:37
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 845 ms
コンパイル使用メモリ 106,112 KB
実行使用メモリ 20,736 KB
最終ジャッジ日時 2024-05-05 12:48:03
合計ジャッジ時間 3,794 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
20,096 KB
testcase_01 AC 35 ms
20,352 KB
testcase_02 AC 35 ms
19,968 KB
testcase_03 WA -
testcase_04 AC 35 ms
20,096 KB
testcase_05 AC 34 ms
20,352 KB
testcase_06 AC 34 ms
20,224 KB
testcase_07 AC 39 ms
20,480 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 39 ms
20,480 KB
testcase_11 RE -
testcase_12 AC 33 ms
19,456 KB
testcase_13 WA -
testcase_14 AC 33 ms
19,456 KB
testcase_15 AC 40 ms
20,608 KB
testcase_16 AC 40 ms
20,736 KB
testcase_17 AC 39 ms
20,608 KB
testcase_18 AC 39 ms
20,224 KB
testcase_19 AC 39 ms
20,608 KB
testcase_20 AC 40 ms
20,608 KB
testcase_21 AC 39 ms
20,608 KB
testcase_22 AC 41 ms
20,480 KB
testcase_23 WA -
testcase_24 AC 39 ms
20,096 KB
testcase_25 AC 39 ms
20,480 KB
testcase_26 WA -
testcase_27 AC 38 ms
20,608 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 39 ms
20,608 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 39 ms
20,608 KB
testcase_38 AC 39 ms
20,480 KB
testcase_39 AC 37 ms
20,352 KB
testcase_40 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.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);
        }
    }
}
0