結果

問題 No.275 中央値を求めよ
ユーザー funakoshifunakoshi
提出日時 2019-06-27 13:30:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 73 ms / 1,000 ms
コード長 837 bytes
コンパイル時間 4,317 ms
コンパイル使用メモリ 104,176 KB
実行使用メモリ 24,848 KB
最終ジャッジ日時 2023-09-10 00:07:49
合計ジャッジ時間 8,627 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,648 KB
testcase_01 AC 64 ms
22,688 KB
testcase_02 AC 63 ms
20,676 KB
testcase_03 AC 59 ms
20,760 KB
testcase_04 AC 65 ms
24,740 KB
testcase_05 AC 64 ms
22,536 KB
testcase_06 AC 65 ms
22,660 KB
testcase_07 AC 72 ms
22,844 KB
testcase_08 AC 63 ms
21,024 KB
testcase_09 AC 65 ms
20,964 KB
testcase_10 AC 71 ms
22,720 KB
testcase_11 AC 58 ms
22,760 KB
testcase_12 AC 61 ms
22,808 KB
testcase_13 AC 59 ms
20,716 KB
testcase_14 AC 61 ms
20,708 KB
testcase_15 AC 72 ms
22,864 KB
testcase_16 AC 71 ms
22,812 KB
testcase_17 AC 72 ms
22,920 KB
testcase_18 AC 72 ms
22,728 KB
testcase_19 AC 66 ms
20,864 KB
testcase_20 AC 69 ms
22,756 KB
testcase_21 AC 72 ms
22,880 KB
testcase_22 AC 71 ms
22,740 KB
testcase_23 AC 69 ms
22,968 KB
testcase_24 AC 72 ms
22,784 KB
testcase_25 AC 73 ms
22,744 KB
testcase_26 AC 68 ms
20,920 KB
testcase_27 AC 68 ms
23,040 KB
testcase_28 AC 58 ms
22,648 KB
testcase_29 AC 68 ms
22,980 KB
testcase_30 AC 59 ms
20,772 KB
testcase_31 AC 73 ms
22,840 KB
testcase_32 AC 66 ms
20,852 KB
testcase_33 AC 67 ms
22,888 KB
testcase_34 AC 58 ms
20,780 KB
testcase_35 AC 66 ms
20,988 KB
testcase_36 AC 64 ms
20,988 KB
testcase_37 AC 69 ms
22,768 KB
testcase_38 AC 72 ms
24,848 KB
testcase_39 AC 68 ms
23,036 KB
testcase_40 AC 67 ms
23,028 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 yukicoderTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] input2 = Console.ReadLine().Split(' ');
            int[] num = new int[input2.Length];
            for(int i=0;i<num.Length;i++)
            {
                num[i] = int.Parse(input2[i]);
            }
            Array.Sort(num);
            if(num.Length%2==1)
            {
                Console.WriteLine(num[num.Length / 2]);
            }
            else
            {
                double ans = ((double)num[num.Length / 2] + (double)num[(num.Length / 2) - 1])/2;
                Console.WriteLine(ans);
            }
        }

    }
}
0