結果

問題 No.275 中央値を求めよ
ユーザー chankou0920chankou0920
提出日時 2017-09-29 11:40:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 78 ms / 1,000 ms
コード長 479 bytes
コンパイル時間 4,559 ms
コンパイル使用メモリ 105,916 KB
実行使用メモリ 24,932 KB
最終ジャッジ日時 2023-09-07 06:16:45
合計ジャッジ時間 6,488 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
24,668 KB
testcase_01 AC 65 ms
22,544 KB
testcase_02 AC 65 ms
24,700 KB
testcase_03 AC 58 ms
20,692 KB
testcase_04 AC 64 ms
22,636 KB
testcase_05 AC 64 ms
24,540 KB
testcase_06 AC 64 ms
22,504 KB
testcase_07 AC 73 ms
22,780 KB
testcase_08 AC 69 ms
18,840 KB
testcase_09 AC 66 ms
20,836 KB
testcase_10 AC 72 ms
24,888 KB
testcase_11 AC 57 ms
20,660 KB
testcase_12 AC 61 ms
18,744 KB
testcase_13 AC 59 ms
20,620 KB
testcase_14 AC 64 ms
20,860 KB
testcase_15 AC 72 ms
22,852 KB
testcase_16 AC 73 ms
24,904 KB
testcase_17 AC 74 ms
22,892 KB
testcase_18 AC 73 ms
22,764 KB
testcase_19 AC 67 ms
20,972 KB
testcase_20 AC 73 ms
24,932 KB
testcase_21 AC 72 ms
22,884 KB
testcase_22 AC 72 ms
22,844 KB
testcase_23 AC 67 ms
22,932 KB
testcase_24 AC 73 ms
24,756 KB
testcase_25 AC 73 ms
22,956 KB
testcase_26 AC 68 ms
21,080 KB
testcase_27 AC 68 ms
20,956 KB
testcase_28 AC 60 ms
20,724 KB
testcase_29 AC 68 ms
20,940 KB
testcase_30 AC 60 ms
20,620 KB
testcase_31 AC 73 ms
22,868 KB
testcase_32 AC 67 ms
21,004 KB
testcase_33 AC 68 ms
20,972 KB
testcase_34 AC 60 ms
20,756 KB
testcase_35 AC 68 ms
22,884 KB
testcase_36 AC 67 ms
20,908 KB
testcase_37 AC 72 ms
22,732 KB
testcase_38 AC 78 ms
22,844 KB
testcase_39 AC 72 ms
22,984 KB
testcase_40 AC 68 ms
20,936 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program {
	public static void Main(string[] args) {
		Console.ReadLine();
		string[] s = Console.ReadLine().Split(' ');
		int[] array = new int[s.Length];
		for (int i = 0; i < array.Length; i++) {
			array[i] = int.Parse(s[i]);
		}
		Array.Sort(array);
		if (array.Length % 2 == 0) {
			float mid = (array[array.Length/2-1]+array[array.Length/2]) / 2f;
			Console.WriteLine(mid);
			
		} else {
			Console.WriteLine(array[array.Length / 2]);
		}
	}
}
0