結果

問題 No.275 中央値を求めよ
ユーザー kmtrc130kmtrc130
提出日時 2019-03-18 15:42:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 76 ms / 1,000 ms
コード長 610 bytes
コンパイル時間 2,146 ms
コンパイル使用メモリ 106,416 KB
実行使用メモリ 25,860 KB
最終ジャッジ日時 2023-09-25 13:07:55
合計ジャッジ時間 6,844 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
23,452 KB
testcase_01 AC 66 ms
21,584 KB
testcase_02 AC 68 ms
23,456 KB
testcase_03 AC 61 ms
21,604 KB
testcase_04 AC 66 ms
23,492 KB
testcase_05 AC 66 ms
23,540 KB
testcase_06 AC 67 ms
23,444 KB
testcase_07 AC 75 ms
23,600 KB
testcase_08 AC 68 ms
21,768 KB
testcase_09 AC 68 ms
21,764 KB
testcase_10 AC 74 ms
25,792 KB
testcase_11 AC 58 ms
21,616 KB
testcase_12 AC 64 ms
21,604 KB
testcase_13 AC 62 ms
23,700 KB
testcase_14 AC 64 ms
21,604 KB
testcase_15 AC 75 ms
23,716 KB
testcase_16 AC 74 ms
21,692 KB
testcase_17 AC 74 ms
23,760 KB
testcase_18 AC 75 ms
23,824 KB
testcase_19 AC 69 ms
23,780 KB
testcase_20 AC 75 ms
23,800 KB
testcase_21 AC 74 ms
23,632 KB
testcase_22 AC 74 ms
23,860 KB
testcase_23 AC 70 ms
21,792 KB
testcase_24 AC 75 ms
25,836 KB
testcase_25 AC 74 ms
23,792 KB
testcase_26 AC 68 ms
19,848 KB
testcase_27 AC 69 ms
19,752 KB
testcase_28 AC 62 ms
21,732 KB
testcase_29 AC 69 ms
19,896 KB
testcase_30 AC 62 ms
21,740 KB
testcase_31 AC 74 ms
21,652 KB
testcase_32 AC 68 ms
23,848 KB
testcase_33 AC 69 ms
21,756 KB
testcase_34 AC 62 ms
21,684 KB
testcase_35 AC 69 ms
21,688 KB
testcase_36 AC 68 ms
21,680 KB
testcase_37 AC 74 ms
25,860 KB
testcase_38 AC 76 ms
25,836 KB
testcase_39 AC 71 ms
23,780 KB
testcase_40 AC 68 ms
21,840 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.Collections.Generic;
using System.Linq;

class Program
{
    public void Solve()
    {
        int N = int.Parse(Console.ReadLine());
        int[] A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        Array.Sort(A);

        int mid = A.Length / 2;

        if (0 < A.Length % 2)
        {
            Console.WriteLine(A[(int)mid]);
        }
        else
        {
            Console.WriteLine((float)(A[(int)mid - 1] + A[(int)mid]) / 2);
        }
    }

    static void Main()
    {
        var solver = new Program();
        solver.Solve();
    }
}
0