結果

問題 No.275 中央値を求めよ
ユーザー YOSHIYOSHI
提出日時 2021-03-08 18:56:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 91 ms / 1,000 ms
コード長 614 bytes
コンパイル時間 3,821 ms
コンパイル使用メモリ 79,228 KB
実行使用メモリ 53,580 KB
最終ジャッジ日時 2024-04-18 17:41:30
合計ジャッジ時間 8,240 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
51,592 KB
testcase_01 AC 65 ms
51,412 KB
testcase_02 AC 66 ms
51,460 KB
testcase_03 AC 65 ms
51,364 KB
testcase_04 AC 65 ms
51,604 KB
testcase_05 AC 66 ms
51,424 KB
testcase_06 AC 64 ms
51,088 KB
testcase_07 AC 82 ms
52,472 KB
testcase_08 AC 67 ms
51,428 KB
testcase_09 AC 66 ms
51,324 KB
testcase_10 AC 68 ms
51,540 KB
testcase_11 AC 65 ms
53,112 KB
testcase_12 AC 65 ms
51,432 KB
testcase_13 AC 64 ms
51,460 KB
testcase_14 AC 65 ms
51,140 KB
testcase_15 AC 87 ms
53,580 KB
testcase_16 AC 91 ms
53,504 KB
testcase_17 AC 75 ms
51,676 KB
testcase_18 AC 69 ms
52,204 KB
testcase_19 AC 85 ms
52,364 KB
testcase_20 AC 85 ms
52,476 KB
testcase_21 AC 75 ms
52,432 KB
testcase_22 AC 86 ms
52,308 KB
testcase_23 AC 73 ms
52,308 KB
testcase_24 AC 74 ms
52,580 KB
testcase_25 AC 88 ms
52,568 KB
testcase_26 AC 88 ms
52,712 KB
testcase_27 AC 84 ms
52,028 KB
testcase_28 AC 63 ms
51,156 KB
testcase_29 AC 73 ms
52,304 KB
testcase_30 AC 66 ms
51,516 KB
testcase_31 AC 88 ms
52,476 KB
testcase_32 AC 67 ms
51,396 KB
testcase_33 AC 85 ms
53,384 KB
testcase_34 AC 66 ms
51,092 KB
testcase_35 AC 75 ms
52,572 KB
testcase_36 AC 69 ms
51,276 KB
testcase_37 AC 64 ms
51,432 KB
testcase_38 AC 73 ms
52,468 KB
testcase_39 AC 69 ms
51,376 KB
testcase_40 AC 89 ms
53,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.stream.Stream;

public class No00000275_Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		double[] arr = Stream.of(br.readLine().split(" ")).mapToDouble(Double::parseDouble).toArray();
		Arrays.sort(arr);
		if(n % 2 == 0) {
			System.out.println((arr[(n / 2) - 1] + arr[n / 2]) / 2);
		} else {
			System.out.println(arr[n / 2]);
		}
	}
}
0