結果

問題 No.275 中央値を求めよ
ユーザー mbanmban
提出日時 2016-11-05 10:40:17
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 78 ms / 1,000 ms
コード長 512 bytes
コンパイル時間 2,979 ms
コンパイル使用メモリ 104,152 KB
実行使用メモリ 26,020 KB
最終ジャッジ日時 2023-09-07 05:40:25
合計ジャッジ時間 6,664 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
23,700 KB
testcase_01 AC 68 ms
23,556 KB
testcase_02 AC 68 ms
23,704 KB
testcase_03 AC 63 ms
23,748 KB
testcase_04 AC 69 ms
23,572 KB
testcase_05 AC 69 ms
23,716 KB
testcase_06 AC 68 ms
23,704 KB
testcase_07 AC 76 ms
23,728 KB
testcase_08 AC 69 ms
21,836 KB
testcase_09 AC 69 ms
21,776 KB
testcase_10 AC 75 ms
23,868 KB
testcase_11 AC 61 ms
21,644 KB
testcase_12 AC 65 ms
23,732 KB
testcase_13 AC 62 ms
21,612 KB
testcase_14 AC 66 ms
21,592 KB
testcase_15 AC 76 ms
23,812 KB
testcase_16 AC 77 ms
25,956 KB
testcase_17 AC 76 ms
23,952 KB
testcase_18 AC 76 ms
23,960 KB
testcase_19 AC 70 ms
21,784 KB
testcase_20 AC 76 ms
26,020 KB
testcase_21 AC 77 ms
25,700 KB
testcase_22 AC 76 ms
25,888 KB
testcase_23 AC 72 ms
23,836 KB
testcase_24 AC 76 ms
23,852 KB
testcase_25 AC 77 ms
25,892 KB
testcase_26 AC 72 ms
21,828 KB
testcase_27 AC 72 ms
19,684 KB
testcase_28 AC 64 ms
21,736 KB
testcase_29 AC 73 ms
21,856 KB
testcase_30 AC 63 ms
23,632 KB
testcase_31 AC 77 ms
21,896 KB
testcase_32 AC 70 ms
21,728 KB
testcase_33 AC 71 ms
21,752 KB
testcase_34 AC 62 ms
19,664 KB
testcase_35 AC 73 ms
21,820 KB
testcase_36 AC 74 ms
23,736 KB
testcase_37 AC 77 ms
25,852 KB
testcase_38 AC 78 ms
25,920 KB
testcase_39 AC 74 ms
23,896 KB
testcase_40 AC 71 ms
19,880 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;
using System.Text;
using System.Threading.Tasks;

class Magatro
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        Array.Sort(a);
        if (N % 2 == 0)
        {
            Console.WriteLine((double)(a[N / 2] + a[N / 2 - 1]) / 2);
        }
        else
        {
            Console.WriteLine(a[N / 2]);
        }
    }
}
0