結果

問題 No.275 中央値を求めよ
ユーザー yuuki121
提出日時 2020-12-24 00:12:16
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 2,397 ms
コンパイル使用メモリ 85,584 KB
実行使用メモリ 38,600 KB
最終ジャッジ日時 2024-09-21 16:37:29
合計ジャッジ時間 5,725 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 9 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//入力値読み込み
		int count = Integer.parseInt(br.readLine());
		int[] num = Stream.of(br.readLine().split(" ")).mapToInt(n -> Integer.parseInt(n)).toArray();

		System.out.println((count % 2 == 0) ? (num[count / 2 - 1] + num[count / 2]) / 2.0 : num[count / 2]);
	}
}
0