結果

問題 No.275 中央値を求めよ
ユーザー itok217itok217
提出日時 2017-04-10 22:41:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 80 ms / 1,000 ms
コード長 383 bytes
コンパイル時間 2,344 ms
コンパイル使用メモリ 103,688 KB
実行使用メモリ 25,960 KB
最終ジャッジ日時 2023-09-07 06:02:26
合計ジャッジ時間 6,926 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
23,852 KB
testcase_01 AC 70 ms
23,600 KB
testcase_02 AC 69 ms
23,696 KB
testcase_03 AC 65 ms
21,676 KB
testcase_04 AC 71 ms
25,864 KB
testcase_05 AC 69 ms
23,576 KB
testcase_06 AC 71 ms
25,620 KB
testcase_07 AC 78 ms
24,116 KB
testcase_08 AC 73 ms
21,944 KB
testcase_09 AC 73 ms
23,928 KB
testcase_10 AC 77 ms
21,780 KB
testcase_11 AC 64 ms
21,820 KB
testcase_12 AC 68 ms
21,740 KB
testcase_13 AC 64 ms
23,668 KB
testcase_14 AC 67 ms
23,868 KB
testcase_15 AC 79 ms
23,956 KB
testcase_16 AC 79 ms
23,936 KB
testcase_17 AC 80 ms
25,956 KB
testcase_18 AC 79 ms
25,840 KB
testcase_19 AC 74 ms
23,832 KB
testcase_20 AC 78 ms
23,840 KB
testcase_21 AC 78 ms
25,960 KB
testcase_22 AC 78 ms
25,908 KB
testcase_23 AC 72 ms
21,916 KB
testcase_24 AC 78 ms
24,016 KB
testcase_25 AC 78 ms
24,052 KB
testcase_26 AC 73 ms
21,768 KB
testcase_27 AC 73 ms
21,892 KB
testcase_28 AC 66 ms
23,832 KB
testcase_29 AC 74 ms
24,016 KB
testcase_30 AC 66 ms
21,708 KB
testcase_31 AC 78 ms
21,752 KB
testcase_32 AC 72 ms
21,928 KB
testcase_33 AC 76 ms
23,932 KB
testcase_34 AC 66 ms
23,772 KB
testcase_35 AC 74 ms
23,908 KB
testcase_36 AC 74 ms
24,036 KB
testcase_37 AC 77 ms
23,972 KB
testcase_38 AC 78 ms
23,796 KB
testcase_39 AC 74 ms
21,964 KB
testcase_40 AC 73 ms
23,900 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.Linq;

class Program {
    static void Main() {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
        if (n % 2 == 0) {
            Console.WriteLine((double)(a[n / 2 - 1] + a[n / 2]) / 2);
        } else {
            Console.WriteLine(a[n / 2]);
        }
    }
}
0