結果

問題 No.275 中央値を求めよ
ユーザー ototonariototonari
提出日時 2017-03-16 16:51:52
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 76 ms / 1,000 ms
コード長 968 bytes
コンパイル時間 2,326 ms
コンパイル使用メモリ 100,508 KB
実行使用メモリ 25,064 KB
最終ジャッジ日時 2023-09-07 05:57:34
合計ジャッジ時間 6,324 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,880 KB
testcase_01 AC 65 ms
20,896 KB
testcase_02 AC 66 ms
24,828 KB
testcase_03 AC 60 ms
22,664 KB
testcase_04 AC 66 ms
22,904 KB
testcase_05 AC 65 ms
22,808 KB
testcase_06 AC 65 ms
20,652 KB
testcase_07 AC 73 ms
25,064 KB
testcase_08 AC 65 ms
20,860 KB
testcase_09 AC 67 ms
20,748 KB
testcase_10 AC 74 ms
22,912 KB
testcase_11 AC 56 ms
20,748 KB
testcase_12 AC 64 ms
20,736 KB
testcase_13 AC 60 ms
22,700 KB
testcase_14 AC 64 ms
20,704 KB
testcase_15 AC 75 ms
25,044 KB
testcase_16 AC 74 ms
20,884 KB
testcase_17 AC 75 ms
24,952 KB
testcase_18 AC 73 ms
24,972 KB
testcase_19 AC 68 ms
18,936 KB
testcase_20 AC 74 ms
25,024 KB
testcase_21 AC 74 ms
22,840 KB
testcase_22 AC 74 ms
23,020 KB
testcase_23 AC 68 ms
20,768 KB
testcase_24 AC 75 ms
22,900 KB
testcase_25 AC 74 ms
22,936 KB
testcase_26 AC 69 ms
22,828 KB
testcase_27 AC 68 ms
20,940 KB
testcase_28 AC 59 ms
22,704 KB
testcase_29 AC 66 ms
20,856 KB
testcase_30 AC 59 ms
20,808 KB
testcase_31 AC 73 ms
22,928 KB
testcase_32 AC 66 ms
20,916 KB
testcase_33 AC 66 ms
20,888 KB
testcase_34 AC 59 ms
20,676 KB
testcase_35 AC 69 ms
18,860 KB
testcase_36 AC 68 ms
22,900 KB
testcase_37 AC 74 ms
25,012 KB
testcase_38 AC 76 ms
24,988 KB
testcase_39 AC 67 ms
20,768 KB
testcase_40 AC 68 ms
18,876 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 yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] numArray = new int[int.Parse(Console.ReadLine())];

            string s = Console.ReadLine();
            string[] t = s.Split(' ');
            
            for(int i = 0; i < t.Length; i++)
            {
                numArray[i] = int.Parse(t[i]);
            }

            Array.Sort(numArray);
            int j = numArray.Length;
            if(j % 2 == 0)
            {
                double tmp = numArray[j / 2];
                tmp = (tmp + numArray[(j / 2) - 1]) / 2;
                Console.WriteLine("{0}", tmp);
            }
            else
            {
                Console.WriteLine(numArray[j / 2]);
            }
            //Console.ReadLine();

        }
    }
}
0