結果

問題 No.275 中央値を求めよ
ユーザー AtriaAtria
提出日時 2019-11-10 19:08:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 77 ms / 1,000 ms
コード長 670 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 69,944 KB
実行使用メモリ 26,064 KB
最終ジャッジ日時 2023-10-13 07:50:42
合計ジャッジ時間 5,836 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
25,724 KB
testcase_01 AC 67 ms
23,940 KB
testcase_02 AC 69 ms
21,752 KB
testcase_03 AC 66 ms
23,656 KB
testcase_04 AC 67 ms
23,680 KB
testcase_05 AC 67 ms
25,764 KB
testcase_06 AC 69 ms
23,708 KB
testcase_07 AC 75 ms
26,064 KB
testcase_08 AC 73 ms
23,940 KB
testcase_09 AC 76 ms
25,984 KB
testcase_10 AC 75 ms
23,944 KB
testcase_11 AC 68 ms
21,708 KB
testcase_12 AC 68 ms
23,836 KB
testcase_13 AC 65 ms
19,712 KB
testcase_14 AC 65 ms
21,772 KB
testcase_15 AC 74 ms
23,964 KB
testcase_16 AC 74 ms
23,996 KB
testcase_17 AC 76 ms
25,984 KB
testcase_18 AC 75 ms
21,940 KB
testcase_19 AC 73 ms
25,872 KB
testcase_20 AC 75 ms
25,984 KB
testcase_21 AC 75 ms
24,024 KB
testcase_22 AC 77 ms
24,012 KB
testcase_23 AC 77 ms
24,120 KB
testcase_24 AC 75 ms
23,888 KB
testcase_25 AC 76 ms
25,936 KB
testcase_26 AC 76 ms
23,880 KB
testcase_27 AC 74 ms
25,980 KB
testcase_28 AC 68 ms
25,948 KB
testcase_29 AC 74 ms
23,904 KB
testcase_30 AC 67 ms
21,608 KB
testcase_31 AC 76 ms
25,908 KB
testcase_32 AC 73 ms
24,052 KB
testcase_33 AC 76 ms
23,940 KB
testcase_34 AC 69 ms
25,776 KB
testcase_35 AC 77 ms
23,992 KB
testcase_36 AC 75 ms
21,892 KB
testcase_37 AC 74 ms
23,980 KB
testcase_38 AC 75 ms
24,000 KB
testcase_39 AC 75 ms
24,044 KB
testcase_40 AC 75 ms
23,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            double[] s = ReadLine().Split(' ').Select(double.Parse).ToArray();
            Array.Sort(s);
            if (s.Length %2 != 0)
            {
                WriteLine(s[s.Length/2]);
            }
            else
            {
                WriteLine(
                    (s[s.Length/2] + s[(s.Length/2)-1])/2
                    );
            }
        }
    }
}
0