結果

問題 No.275 中央値を求めよ
ユーザー nokonokonokonoko
提出日時 2015-10-05 01:28:00
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 84 ms / 1,000 ms
コード長 1,736 bytes
コンパイル時間 3,730 ms
コンパイル使用メモリ 105,836 KB
実行使用メモリ 26,092 KB
最終ジャッジ日時 2023-09-07 04:48:58
合計ジャッジ時間 8,584 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
23,872 KB
testcase_01 AC 74 ms
23,716 KB
testcase_02 AC 74 ms
23,780 KB
testcase_03 AC 74 ms
25,816 KB
testcase_04 AC 77 ms
23,884 KB
testcase_05 AC 74 ms
23,756 KB
testcase_06 AC 74 ms
23,704 KB
testcase_07 AC 82 ms
25,952 KB
testcase_08 AC 81 ms
23,948 KB
testcase_09 AC 81 ms
23,952 KB
testcase_10 AC 83 ms
24,188 KB
testcase_11 AC 72 ms
23,692 KB
testcase_12 AC 71 ms
21,940 KB
testcase_13 AC 71 ms
19,884 KB
testcase_14 AC 72 ms
21,968 KB
testcase_15 AC 84 ms
23,972 KB
testcase_16 AC 83 ms
23,980 KB
testcase_17 AC 84 ms
23,912 KB
testcase_18 AC 83 ms
23,996 KB
testcase_19 AC 82 ms
24,124 KB
testcase_20 AC 84 ms
24,012 KB
testcase_21 AC 83 ms
24,100 KB
testcase_22 AC 82 ms
23,944 KB
testcase_23 AC 82 ms
25,928 KB
testcase_24 AC 84 ms
26,092 KB
testcase_25 AC 82 ms
23,972 KB
testcase_26 AC 83 ms
24,044 KB
testcase_27 AC 82 ms
24,080 KB
testcase_28 AC 74 ms
23,928 KB
testcase_29 AC 83 ms
23,988 KB
testcase_30 AC 75 ms
23,892 KB
testcase_31 AC 82 ms
23,960 KB
testcase_32 AC 82 ms
25,952 KB
testcase_33 AC 82 ms
23,992 KB
testcase_34 AC 75 ms
25,756 KB
testcase_35 AC 82 ms
24,048 KB
testcase_36 AC 81 ms
24,024 KB
testcase_37 AC 80 ms
25,920 KB
testcase_38 AC 83 ms
24,076 KB
testcase_39 AC 81 ms
23,972 KB
testcase_40 AC 82 ms
24,160 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.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int cnt = LIB.IO.R<int>();
        double[] data = LIB.IO.R<double>(' ');
        Array.Sort(data);
        LIB.IO.W(data.Count() % 2 == 0 ? (data[data.Count() / 2 - 1] + data[data.Count() / 2]) / 2 : data[data.Count() / 2]);
        LIB.IO.WFLUSH();
    }
}

namespace LIB
{
    public class IO
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T R<T>() { return UTILITY.PARSE<T>(R()); }
        public static T[] R<T>(char s = ' ') { return R().Split(s).Select(UTILITY.PARSE<T>).ToArray(); }
        public static T[] R<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = R<T>(); } return r; }
        public static T[][] R<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = R<T>(s); } return r; }
        private static string R() { return Console.ReadLine(); }
        public static void W(object v, bool lf = true) { S.Append(UTILITY.PARSE<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { WFLUSH(); } }
        public static void WFLUSH() { Console.Write(S.ToString()); S.Clear(); }
    }
    public class UTILITY
    {
        public static T PARSE<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class MEMO<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public MEMO() { R = new Dictionary<Key, Result>(); }
        public Result EXEC(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}
0