結果

問題 No.275 中央値を求めよ
ユーザー p_nixp_nix
提出日時 2018-01-26 01:02:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 79 ms / 1,000 ms
コード長 636 bytes
コンパイル時間 2,317 ms
コンパイル使用メモリ 102,752 KB
実行使用メモリ 26,020 KB
最終ジャッジ日時 2023-09-07 06:25:37
合計ジャッジ時間 6,694 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
25,500 KB
testcase_01 AC 68 ms
23,724 KB
testcase_02 AC 68 ms
23,548 KB
testcase_03 AC 63 ms
21,688 KB
testcase_04 AC 70 ms
23,548 KB
testcase_05 AC 68 ms
25,528 KB
testcase_06 AC 68 ms
25,548 KB
testcase_07 AC 75 ms
25,728 KB
testcase_08 AC 70 ms
21,716 KB
testcase_09 AC 70 ms
21,668 KB
testcase_10 AC 75 ms
23,700 KB
testcase_11 AC 60 ms
21,696 KB
testcase_12 AC 64 ms
21,748 KB
testcase_13 AC 62 ms
21,780 KB
testcase_14 AC 65 ms
21,784 KB
testcase_15 AC 79 ms
25,896 KB
testcase_16 AC 79 ms
23,848 KB
testcase_17 AC 75 ms
26,020 KB
testcase_18 AC 76 ms
23,760 KB
testcase_19 AC 70 ms
21,848 KB
testcase_20 AC 76 ms
25,744 KB
testcase_21 AC 75 ms
23,812 KB
testcase_22 AC 76 ms
25,748 KB
testcase_23 AC 74 ms
21,764 KB
testcase_24 AC 75 ms
23,864 KB
testcase_25 AC 75 ms
25,780 KB
testcase_26 AC 70 ms
19,848 KB
testcase_27 AC 71 ms
21,748 KB
testcase_28 AC 61 ms
21,540 KB
testcase_29 AC 70 ms
23,848 KB
testcase_30 AC 63 ms
23,592 KB
testcase_31 AC 75 ms
23,784 KB
testcase_32 AC 69 ms
23,796 KB
testcase_33 AC 72 ms
21,856 KB
testcase_34 AC 67 ms
21,676 KB
testcase_35 AC 74 ms
19,768 KB
testcase_36 AC 71 ms
23,792 KB
testcase_37 AC 74 ms
23,696 KB
testcase_38 AC 78 ms
25,788 KB
testcase_39 AC 71 ms
23,780 KB
testcase_40 AC 71 ms
23,780 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;

namespace prob275
{
    class Program
    {
        static void Main(string[] args)
        {
            int cnt = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            Array.Sort(a);

            if (a.Length % 2 ==0)
            {
                Console.WriteLine((float)(a[a.Length / 2 -1] + a[a.Length / 2 ])/2);
            }
            else
            {
                Console.WriteLine(a[a.Length /2]);
            }

        }
    }
}
0