結果

問題 No.275 中央値を求めよ
ユーザー バカらっくバカらっく
提出日時 2018-02-17 23:02:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 80 ms / 1,000 ms
コード長 1,265 bytes
コンパイル時間 2,347 ms
コンパイル使用メモリ 106,104 KB
実行使用メモリ 24,232 KB
最終ジャッジ日時 2023-09-07 06:27:39
合計ジャッジ時間 6,960 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
23,912 KB
testcase_01 AC 69 ms
21,960 KB
testcase_02 AC 70 ms
19,936 KB
testcase_03 AC 66 ms
21,732 KB
testcase_04 AC 68 ms
21,868 KB
testcase_05 AC 69 ms
21,876 KB
testcase_06 AC 68 ms
21,920 KB
testcase_07 AC 77 ms
24,204 KB
testcase_08 AC 73 ms
21,972 KB
testcase_09 AC 74 ms
21,840 KB
testcase_10 AC 78 ms
24,212 KB
testcase_11 AC 65 ms
21,672 KB
testcase_12 AC 69 ms
21,896 KB
testcase_13 AC 66 ms
21,668 KB
testcase_14 AC 68 ms
21,952 KB
testcase_15 AC 78 ms
22,024 KB
testcase_16 AC 77 ms
22,144 KB
testcase_17 AC 79 ms
24,232 KB
testcase_18 AC 78 ms
24,084 KB
testcase_19 AC 77 ms
21,880 KB
testcase_20 AC 79 ms
22,148 KB
testcase_21 AC 78 ms
24,060 KB
testcase_22 AC 77 ms
20,168 KB
testcase_23 AC 77 ms
21,936 KB
testcase_24 AC 77 ms
22,076 KB
testcase_25 AC 80 ms
24,224 KB
testcase_26 AC 75 ms
21,796 KB
testcase_27 AC 76 ms
22,000 KB
testcase_28 AC 67 ms
21,624 KB
testcase_29 AC 75 ms
23,908 KB
testcase_30 AC 67 ms
23,636 KB
testcase_31 AC 76 ms
22,184 KB
testcase_32 AC 74 ms
23,868 KB
testcase_33 AC 76 ms
21,800 KB
testcase_34 AC 66 ms
21,668 KB
testcase_35 AC 74 ms
21,884 KB
testcase_36 AC 75 ms
21,948 KB
testcase_37 AC 76 ms
22,168 KB
testcase_38 AC 78 ms
22,176 KB
testcase_39 AC 75 ms
21,944 KB
testcase_40 AC 75 ms
21,948 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.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int inputCount = int.Parse(Reader.ReadLine());
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).OrderBy(a => a).ToArray();
        decimal ans = 0;
        if(inputCount%2==0) {
            ans = (inpt[inputCount / 2 - 1] + inpt[inputCount / 2]) / 2m;
        } else {
            ans = inpt[inputCount / 2];
        }
        Console.WriteLine(ans);
    }


    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"



4
1 9 8 4


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}
0