結果

問題 No.275 中央値を求めよ
ユーザー kamonegi2236
提出日時 2015-09-12 13:36:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 103,168 KB
実行使用メモリ 19,840 KB
最終ジャッジ日時 2024-07-19 06:17:18
合計ジャッジ時間 3,545 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No275
{
    class center
    {
        static void Main()
        {
            string str = Console.ReadLine();
            int i = int.Parse(str);
            string[] list = Console.ReadLine().Split(' ');
            Array.Sort(list);
            if (i % 2 == 1)
            {
                Console.WriteLine(list[(i + 1) / 2 - 1]);
            }
            else
            {
                double ans = (double.Parse(list[i / 2 - 1]) + double.Parse(list[i / 2])) / 2;
                Console.WriteLine(ans);
            }
        }
    }
}
0