結果

問題 No.275 中央値を求めよ
ユーザー nokonokonokonoko
提出日時 2015-10-06 22:49:18
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 1,704 bytes
コンパイル時間 2,818 ms
コンパイル使用メモリ 108,848 KB
実行使用メモリ 26,116 KB
最終ジャッジ日時 2023-09-07 04:49:25
合計ジャッジ時間 7,731 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
21,836 KB
testcase_01 AC 75 ms
23,836 KB
testcase_02 AC 76 ms
23,760 KB
testcase_03 AC 74 ms
23,756 KB
testcase_04 AC 78 ms
23,828 KB
testcase_05 AC 75 ms
25,700 KB
testcase_06 AC 79 ms
25,772 KB
testcase_07 AC 86 ms
23,964 KB
testcase_08 AC 82 ms
26,116 KB
testcase_09 AC 81 ms
23,896 KB
testcase_10 AC 81 ms
24,000 KB
testcase_11 AC 76 ms
25,936 KB
testcase_12 AC 75 ms
21,848 KB
testcase_13 AC 71 ms
23,928 KB
testcase_14 AC 72 ms
24,004 KB
testcase_15 AC 84 ms
23,864 KB
testcase_16 AC 86 ms
24,048 KB
testcase_17 AC 86 ms
26,000 KB
testcase_18 AC 86 ms
26,060 KB
testcase_19 AC 84 ms
24,112 KB
testcase_20 AC 83 ms
25,940 KB
testcase_21 AC 83 ms
24,052 KB
testcase_22 AC 83 ms
23,924 KB
testcase_23 AC 83 ms
23,920 KB
testcase_24 AC 82 ms
23,960 KB
testcase_25 AC 83 ms
24,092 KB
testcase_26 AC 83 ms
24,036 KB
testcase_27 AC 82 ms
23,924 KB
testcase_28 AC 79 ms
23,776 KB
testcase_29 AC 82 ms
26,108 KB
testcase_30 AC 75 ms
23,676 KB
testcase_31 AC 82 ms
24,104 KB
testcase_32 AC 81 ms
25,976 KB
testcase_33 AC 83 ms
25,960 KB
testcase_34 AC 74 ms
23,796 KB
testcase_35 AC 84 ms
24,016 KB
testcase_36 AC 82 ms
26,060 KB
testcase_37 AC 82 ms
24,100 KB
testcase_38 AC 82 ms
22,008 KB
testcase_39 AC 82 ms
21,972 KB
testcase_40 AC 82 ms
25,964 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

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

namespace LIB
{
    public class IO
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T R<T>() { return UTIL.PARSE<T>(R()); }
        public static T[] R<T>(char s = ' ') { return R().Split(s).Select(UTIL.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(UTIL.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 UTIL
    {
        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