結果

問題 No.275 中央値を求めよ
ユーザー CroweaCrowea
提出日時 2019-01-21 14:12:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 77 ms / 1,000 ms
コード長 652 bytes
コンパイル時間 862 ms
コンパイル使用メモリ 63,660 KB
実行使用メモリ 25,000 KB
最終ジャッジ日時 2023-10-13 17:16:13
合計ジャッジ時間 5,313 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
24,720 KB
testcase_01 AC 67 ms
20,636 KB
testcase_02 AC 69 ms
22,796 KB
testcase_03 AC 63 ms
22,724 KB
testcase_04 AC 67 ms
22,756 KB
testcase_05 AC 67 ms
22,716 KB
testcase_06 AC 68 ms
22,772 KB
testcase_07 AC 74 ms
24,920 KB
testcase_08 AC 70 ms
21,052 KB
testcase_09 AC 71 ms
20,992 KB
testcase_10 AC 74 ms
23,008 KB
testcase_11 AC 61 ms
22,840 KB
testcase_12 AC 63 ms
20,736 KB
testcase_13 AC 64 ms
20,748 KB
testcase_14 AC 65 ms
22,800 KB
testcase_15 AC 77 ms
22,980 KB
testcase_16 AC 76 ms
22,972 KB
testcase_17 AC 77 ms
24,996 KB
testcase_18 AC 75 ms
22,928 KB
testcase_19 AC 70 ms
20,960 KB
testcase_20 AC 74 ms
22,936 KB
testcase_21 AC 74 ms
24,924 KB
testcase_22 AC 75 ms
25,000 KB
testcase_23 AC 72 ms
23,036 KB
testcase_24 AC 74 ms
22,948 KB
testcase_25 AC 74 ms
23,028 KB
testcase_26 AC 71 ms
21,108 KB
testcase_27 AC 72 ms
21,016 KB
testcase_28 AC 64 ms
20,780 KB
testcase_29 AC 71 ms
21,020 KB
testcase_30 AC 64 ms
22,828 KB
testcase_31 AC 74 ms
22,976 KB
testcase_32 AC 70 ms
22,972 KB
testcase_33 AC 72 ms
21,032 KB
testcase_34 AC 64 ms
20,856 KB
testcase_35 AC 71 ms
21,036 KB
testcase_36 AC 71 ms
22,992 KB
testcase_37 AC 75 ms
24,984 KB
testcase_38 AC 74 ms
22,896 KB
testcase_39 AC 71 ms
23,040 KB
testcase_40 AC 71 ms
23,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var input = Console.ReadLine().Split(' ');
        var list = new List<int>();
        int midIdx;

        foreach (var d in input)
        {
            list.Add(int.Parse(d));
        }
        list.Sort();
        if (N % 2 == 0)
        {
            midIdx = N / 2;
            Console.WriteLine("{0:f1}", (list[midIdx - 1] + list[midIdx]) / 2.0);
        }
        else
        {
            midIdx = N / 2;
            Console.WriteLine("{0:f1}", list[midIdx]);
        }
     }
}

0