結果
| 問題 | No.275 中央値を求めよ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-15 00:16:14 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 109 ms / 1,000 ms |
| コード長 | 538 bytes |
| 記録 | |
| コンパイル時間 | 3,780 ms |
| コンパイル使用メモリ | 82,608 KB |
| 実行使用メモリ | 50,264 KB |
| 最終ジャッジ日時 | 2026-03-11 03:36:19 |
| 合計ジャッジ時間 | 7,266 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
import java.util.Arrays;
import java.util.Scanner;
public class No275 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int[] noList = new int[scanner.nextInt()];
for(int index = 0; index < noList.length; index++) {
noList[index] = scanner.nextInt();
}
Arrays.sort(noList);
if(noList.length % 2 == 1) {
System.out.println(noList[noList.length / 2]);
}
else {
System.out.println((noList[(noList.length / 2) - 1] + noList[noList.length / 2]) / 2.0);
}
scanner.close();
}
}