結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
cande398
|
| 提出日時 | 2017-10-11 16:53:40 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 201 ms / 1,000 ms |
| コード長 | 418 bytes |
| コンパイル時間 | 2,089 ms |
| コンパイル使用メモリ | 74,976 KB |
| 実行使用メモリ | 42,912 KB |
| 最終ジャッジ日時 | 2024-06-25 00:41:59 |
| 合計ジャッジ時間 | 9,985 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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