結果
| 問題 | No.275 中央値を求めよ |
| コンテスト | |
| ユーザー |
cande398
|
| 提出日時 | 2017-10-11 16:53:40 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 117 ms / 1,000 ms |
| コード長 | 418 bytes |
| 記録 | |
| コンパイル時間 | 2,274 ms |
| コンパイル使用メモリ | 82,588 KB |
| 実行使用メモリ | 50,400 KB |
| 最終ジャッジ日時 | 2026-03-11 05:11:06 |
| 合計ジャッジ時間 | 6,640 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
int[] line = new int[num];
for(int i=0;i<num;i++){
line[i] = sc.nextInt();
}
Arrays.sort(line);
if(num%2==0)System.out.println((line[num/2]+line[num/2-1])/2.0);
else System.out.println(line[num/2]);
}
}
cande398