結果
問題 | No.275 中央値を求めよ |
ユーザー |
|
提出日時 | 2020-12-24 00:09:23 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 3,157 ms |
コンパイル使用メモリ | 79,584 KB |
実行使用メモリ | 39,856 KB |
最終ジャッジ日時 | 2024-09-21 16:37:22 |
合計ジャッジ時間 | 7,094 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 31 RE * 4 |
ソースコード
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] + num[count / 2 + 1]) / 2 : num[count / 2 + 1]); } }