結果

問題 No.275 中央値を求めよ
ユーザー phsplsphspls
提出日時 2020-03-28 10:17:11
言語 C#
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 1,000 ms
コード長 399 bytes
コンパイル時間 1,984 ms
使用メモリ 18,048 KB
最終ジャッジ日時 2023-01-17 12:34:11
合計ジャッジ時間 5,391 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 52 ms
17,552 KB
testcase_01 AC 53 ms
17,420 KB
testcase_02 AC 54 ms
17,628 KB
testcase_03 AC 49 ms
15,560 KB
testcase_04 AC 52 ms
17,660 KB
testcase_05 AC 51 ms
17,632 KB
testcase_06 AC 51 ms
17,496 KB
testcase_07 AC 58 ms
17,900 KB
testcase_08 AC 53 ms
15,708 KB
testcase_09 AC 53 ms
15,784 KB
testcase_10 AC 56 ms
17,920 KB
testcase_11 AC 48 ms
15,584 KB
testcase_12 AC 51 ms
15,484 KB
testcase_13 AC 49 ms
15,632 KB
testcase_14 AC 52 ms
15,648 KB
testcase_15 AC 61 ms
17,980 KB
testcase_16 AC 61 ms
17,820 KB
testcase_17 AC 60 ms
17,864 KB
testcase_18 AC 60 ms
18,008 KB
testcase_19 AC 57 ms
15,884 KB
testcase_20 AC 57 ms
17,892 KB
testcase_21 AC 57 ms
17,876 KB
testcase_22 AC 58 ms
17,796 KB
testcase_23 AC 55 ms
15,720 KB
testcase_24 AC 60 ms
17,832 KB
testcase_25 AC 60 ms
17,856 KB
testcase_26 AC 56 ms
15,912 KB
testcase_27 AC 55 ms
15,776 KB
testcase_28 AC 50 ms
15,568 KB
testcase_29 AC 55 ms
15,764 KB
testcase_30 AC 49 ms
15,632 KB
testcase_31 AC 59 ms
18,048 KB
testcase_32 AC 56 ms
15,664 KB
testcase_33 AC 55 ms
15,868 KB
testcase_34 AC 49 ms
15,628 KB
testcase_35 AC 54 ms
16,004 KB
testcase_36 AC 54 ms
15,860 KB
testcase_37 AC 58 ms
17,824 KB
testcase_38 AC 57 ms
17,812 KB
testcase_39 AC 55 ms
15,852 KB
testcase_40 AC 55 ms
15,784 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;

public class P0275 {
    public static void Main() {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToList();
        a.Sort();
        if (n % 2 == 0) {
            Console.WriteLine((a[n/2-1] + a[n/2]) / 2.0);
        } else {
            Console.WriteLine(a[n / 2]);
        }
    }
}
0