結果

問題 No.275 中央値を求めよ
ユーザー TatsuDXTatsuDX
提出日時 2016-09-03 15:24:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 192 ms / 1,000 ms
コード長 429 bytes
コンパイル時間 3,402 ms
コンパイル使用メモリ 72,340 KB
実行使用メモリ 57,192 KB
最終ジャッジ日時 2023-09-07 05:35:09
合計ジャッジ時間 11,416 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
56,064 KB
testcase_01 AC 126 ms
53,804 KB
testcase_02 AC 140 ms
55,768 KB
testcase_03 AC 128 ms
55,668 KB
testcase_04 AC 129 ms
55,916 KB
testcase_05 AC 129 ms
55,540 KB
testcase_06 AC 139 ms
55,876 KB
testcase_07 AC 176 ms
55,800 KB
testcase_08 AC 146 ms
55,832 KB
testcase_09 AC 145 ms
56,068 KB
testcase_10 AC 145 ms
55,852 KB
testcase_11 AC 126 ms
55,788 KB
testcase_12 AC 125 ms
56,024 KB
testcase_13 AC 125 ms
56,188 KB
testcase_14 AC 124 ms
56,276 KB
testcase_15 AC 180 ms
56,288 KB
testcase_16 AC 190 ms
56,244 KB
testcase_17 AC 192 ms
57,060 KB
testcase_18 AC 157 ms
56,028 KB
testcase_19 AC 183 ms
57,192 KB
testcase_20 AC 186 ms
57,012 KB
testcase_21 AC 181 ms
56,124 KB
testcase_22 AC 188 ms
56,144 KB
testcase_23 AC 182 ms
56,124 KB
testcase_24 AC 150 ms
56,316 KB
testcase_25 AC 186 ms
56,144 KB
testcase_26 AC 185 ms
55,964 KB
testcase_27 AC 178 ms
56,284 KB
testcase_28 AC 137 ms
55,952 KB
testcase_29 AC 163 ms
55,840 KB
testcase_30 AC 136 ms
56,156 KB
testcase_31 AC 185 ms
55,844 KB
testcase_32 AC 142 ms
55,844 KB
testcase_33 AC 186 ms
56,384 KB
testcase_34 AC 134 ms
55,976 KB
testcase_35 AC 184 ms
56,028 KB
testcase_36 AC 163 ms
56,156 KB
testcase_37 AC 141 ms
56,372 KB
testcase_38 AC 153 ms
55,624 KB
testcase_39 AC 153 ms
56,184 KB
testcase_40 AC 187 ms
56,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int num = sc.nextInt();
		int[] n = new int[num];
		for (int i = 0; i < num; i++) {
			n[i] = sc.nextInt();
		}
		Arrays.sort(n);
		if (num % 2 == 0) {
			System.out.println((double) (n[num / 2] + n[num / 2 - 1]) / 2);
		} else {
			System.out.println(n[num / 2]);
		}
	}
}
0