結果

問題 No.275 中央値を求めよ
ユーザー kou6839kou6839
提出日時 2015-09-06 16:54:26
言語 Java19
(openjdk 19.0.1)
結果
AC  
実行時間 171 ms / 1,000 ms
コード長 539 bytes
コンパイル時間 2,066 ms
実行使用メモリ 41,316 KB
最終ジャッジ日時 2023-01-22 20:05:39
合計ジャッジ時間 8,790 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
37,504 KB
testcase_01 AC 93 ms
37,660 KB
testcase_02 AC 98 ms
37,636 KB
testcase_03 AC 93 ms
37,404 KB
testcase_04 AC 89 ms
37,488 KB
testcase_05 AC 94 ms
37,952 KB
testcase_06 AC 100 ms
37,876 KB
testcase_07 AC 126 ms
38,904 KB
testcase_08 AC 102 ms
37,960 KB
testcase_09 AC 107 ms
37,992 KB
testcase_10 AC 109 ms
37,956 KB
testcase_11 AC 87 ms
37,468 KB
testcase_12 AC 87 ms
37,448 KB
testcase_13 AC 88 ms
37,500 KB
testcase_14 AC 91 ms
37,580 KB
testcase_15 AC 165 ms
41,316 KB
testcase_16 AC 165 ms
41,264 KB
testcase_17 AC 163 ms
40,848 KB
testcase_18 AC 114 ms
38,004 KB
testcase_19 AC 121 ms
38,408 KB
testcase_20 AC 131 ms
39,040 KB
testcase_21 AC 125 ms
39,112 KB
testcase_22 AC 141 ms
39,416 KB
testcase_23 AC 122 ms
38,704 KB
testcase_24 AC 112 ms
38,004 KB
testcase_25 AC 159 ms
41,232 KB
testcase_26 AC 143 ms
39,312 KB
testcase_27 AC 132 ms
39,020 KB
testcase_28 AC 96 ms
37,696 KB
testcase_29 AC 120 ms
38,608 KB
testcase_30 AC 104 ms
37,716 KB
testcase_31 AC 139 ms
39,216 KB
testcase_32 AC 105 ms
37,780 KB
testcase_33 AC 144 ms
39,292 KB
testcase_34 AC 100 ms
37,620 KB
testcase_35 AC 130 ms
38,652 KB
testcase_36 AC 122 ms
38,652 KB
testcase_37 AC 107 ms
37,896 KB
testcase_38 AC 111 ms
37,960 KB
testcase_39 AC 111 ms
38,092 KB
testcase_40 AC 171 ms
40,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.ObjectInputStream.GetField;
import java.net.NetworkInterface;
import java.util.*;
import java.util.zip.Inflater;

import javax.swing.plaf.synth.SynthSpinnerUI;


public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] input = new int[N];
		for(int i=0; i<N; i++) input[i]=sc.nextInt();
		Arrays.sort(input);
		
		if(N%2!=0){
			System.out.println(input[(N-1)/2]);
		}else{
			System.out.println(1.0*(input[N/2]+input[(N-1)/2])/2);
		}
	}	
}
0