結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
23,540 KB
testcase_01 AC 69 ms
23,544 KB
testcase_02 AC 69 ms
23,668 KB
testcase_03 AC 62 ms
21,760 KB
testcase_04 AC 70 ms
25,580 KB
testcase_05 AC 68 ms
25,580 KB
testcase_06 AC 68 ms
23,720 KB
testcase_07 AC 77 ms
23,820 KB
testcase_08 AC 71 ms
21,720 KB
testcase_09 AC 71 ms
21,724 KB
testcase_10 AC 75 ms
25,780 KB
testcase_11 AC 60 ms
19,712 KB
testcase_12 AC 64 ms
21,788 KB
testcase_13 AC 63 ms
23,728 KB
testcase_14 AC 65 ms
21,748 KB
testcase_15 AC 75 ms
25,884 KB
testcase_16 AC 74 ms
23,920 KB
testcase_17 AC 75 ms
23,812 KB
testcase_18 AC 77 ms
25,912 KB
testcase_19 AC 71 ms
21,784 KB
testcase_20 AC 78 ms
25,956 KB
testcase_21 AC 75 ms
23,672 KB
testcase_22 AC 74 ms
23,800 KB
testcase_23 AC 69 ms
21,764 KB
testcase_24 AC 74 ms
23,728 KB
testcase_25 AC 75 ms
23,808 KB
testcase_26 AC 72 ms
21,896 KB
testcase_27 AC 71 ms
23,916 KB
testcase_28 AC 62 ms
21,712 KB
testcase_29 AC 71 ms
21,772 KB
testcase_30 AC 62 ms
21,644 KB
testcase_31 AC 75 ms
25,912 KB
testcase_32 AC 69 ms
21,760 KB
testcase_33 AC 70 ms
21,748 KB
testcase_34 AC 62 ms
21,820 KB
testcase_35 AC 72 ms
21,824 KB
testcase_36 AC 70 ms
21,648 KB
testcase_37 AC 74 ms
25,884 KB
testcase_38 AC 75 ms
23,872 KB
testcase_39 AC 70 ms
21,844 KB
testcase_40 AC 70 ms
21,728 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