結果

問題 No.275 中央値を求めよ
ユーザー bluemeganebluemegane
提出日時 2018-09-26 09:12:42
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 75 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 3,871 ms
コンパイル使用メモリ 101,080 KB
実行使用メモリ 24,772 KB
最終ジャッジ日時 2023-09-07 07:36:50
合計ジャッジ時間 6,733 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
22,624 KB
testcase_01 AC 63 ms
22,804 KB
testcase_02 AC 65 ms
22,680 KB
testcase_03 AC 64 ms
22,544 KB
testcase_04 AC 64 ms
22,564 KB
testcase_05 AC 63 ms
22,740 KB
testcase_06 AC 63 ms
24,656 KB
testcase_07 AC 72 ms
22,788 KB
testcase_08 AC 73 ms
20,752 KB
testcase_09 AC 73 ms
22,764 KB
testcase_10 AC 71 ms
22,740 KB
testcase_11 AC 62 ms
22,648 KB
testcase_12 AC 60 ms
18,792 KB
testcase_13 AC 61 ms
20,684 KB
testcase_14 AC 62 ms
20,792 KB
testcase_15 AC 72 ms
22,864 KB
testcase_16 AC 72 ms
22,844 KB
testcase_17 AC 72 ms
22,696 KB
testcase_18 AC 72 ms
20,692 KB
testcase_19 AC 73 ms
24,760 KB
testcase_20 AC 74 ms
22,604 KB
testcase_21 AC 74 ms
22,740 KB
testcase_22 AC 72 ms
24,732 KB
testcase_23 AC 70 ms
20,780 KB
testcase_24 AC 71 ms
22,760 KB
testcase_25 AC 71 ms
22,812 KB
testcase_26 AC 72 ms
22,924 KB
testcase_27 AC 72 ms
24,652 KB
testcase_28 AC 65 ms
22,652 KB
testcase_29 AC 75 ms
22,700 KB
testcase_30 AC 64 ms
22,648 KB
testcase_31 AC 72 ms
22,700 KB
testcase_32 AC 71 ms
22,604 KB
testcase_33 AC 72 ms
24,672 KB
testcase_34 AC 64 ms
22,504 KB
testcase_35 AC 74 ms
22,752 KB
testcase_36 AC 72 ms
22,740 KB
testcase_37 AC 70 ms
24,772 KB
testcase_38 AC 71 ms
22,676 KB
testcase_39 AC 73 ms
22,912 KB
testcase_40 AC 73 ms
22,776 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        Array.Sort(a);
        double ans;
        ans = n % 2 == 0 ? (a[n / 2] + a[n / 2 - 1]) / 2d : a[(n - 1) / 2];
        Console.WriteLine(ans);
    }
}
0