結果

問題 No.275 中央値を求めよ
ユーザー nanophoto12nanophoto12
提出日時 2015-12-06 19:43:34
言語 C#
(csc 3.9.0)
結果
AC  
実行時間 70 ms / 1,000 ms
コード長 631 bytes
コンパイル時間 2,049 ms
使用メモリ 22,072 KB
最終ジャッジ日時 2023-01-22 20:37:52
合計ジャッジ時間 6,370 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 63 ms
19,836 KB
testcase_01 AC 62 ms
19,780 KB
testcase_02 AC 62 ms
21,688 KB
testcase_03 AC 58 ms
17,780 KB
testcase_04 AC 61 ms
19,820 KB
testcase_05 AC 62 ms
21,792 KB
testcase_06 AC 63 ms
21,860 KB
testcase_07 AC 69 ms
20,080 KB
testcase_08 AC 64 ms
17,796 KB
testcase_09 AC 64 ms
17,792 KB
testcase_10 AC 68 ms
22,024 KB
testcase_11 AC 55 ms
19,676 KB
testcase_12 AC 59 ms
17,852 KB
testcase_13 AC 58 ms
17,780 KB
testcase_14 AC 60 ms
19,756 KB
testcase_15 AC 69 ms
20,004 KB
testcase_16 AC 70 ms
19,996 KB
testcase_17 AC 70 ms
22,016 KB
testcase_18 AC 69 ms
20,072 KB
testcase_19 AC 65 ms
20,060 KB
testcase_20 AC 69 ms
20,264 KB
testcase_21 AC 70 ms
22,056 KB
testcase_22 AC 70 ms
21,912 KB
testcase_23 AC 65 ms
17,904 KB
testcase_24 AC 70 ms
22,072 KB
testcase_25 AC 70 ms
22,012 KB
testcase_26 AC 64 ms
19,852 KB
testcase_27 AC 65 ms
17,936 KB
testcase_28 AC 58 ms
17,724 KB
testcase_29 AC 65 ms
17,964 KB
testcase_30 AC 57 ms
17,768 KB
testcase_31 AC 70 ms
20,004 KB
testcase_32 AC 63 ms
18,004 KB
testcase_33 AC 65 ms
19,936 KB
testcase_34 AC 57 ms
19,868 KB
testcase_35 AC 65 ms
19,976 KB
testcase_36 AC 64 ms
19,956 KB
testcase_37 AC 68 ms
22,064 KB
testcase_38 AC 69 ms
20,016 KB
testcase_39 AC 65 ms
19,924 KB
testcase_40 AC 65 ms
17,904 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.Collections.Generic;
using System.Linq;
using System.Text;

namespace No275
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var n = Convert.ToInt32(Console.ReadLine ());
			string[] line = Console.ReadLine ().Split(' ');
			int[] data = line.Select (s => Convert.ToInt32 (s)).ToArray();
			Array.Sort (data);
			if (data.Length % 2 == 1) {
				Console.WriteLine (data [data.Length / 2].ToString ());
				return;
			}
			var a = data [data.Length / 2];
			var b = data [data.Length / 2-1];
			var mid = ((double)a + (double)b) / 2d;
			Console.WriteLine (mid.ToString ());
		}
	}
}
0