結果

問題 No.275 中央値を求めよ
ユーザー kou6839kou6839
提出日時 2015-09-06 16:54:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 192 ms / 1,000 ms
コード長 539 bytes
コンパイル時間 2,407 ms
コンパイル使用メモリ 78,672 KB
実行使用メモリ 57,052 KB
最終ジャッジ日時 2023-09-07 04:41:24
合計ジャッジ時間 10,721 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
56,036 KB
testcase_01 AC 126 ms
56,064 KB
testcase_02 AC 140 ms
55,888 KB
testcase_03 AC 125 ms
55,888 KB
testcase_04 AC 127 ms
55,784 KB
testcase_05 AC 128 ms
55,760 KB
testcase_06 AC 138 ms
55,924 KB
testcase_07 AC 180 ms
56,188 KB
testcase_08 AC 142 ms
56,148 KB
testcase_09 AC 143 ms
56,164 KB
testcase_10 AC 142 ms
55,848 KB
testcase_11 AC 127 ms
56,148 KB
testcase_12 AC 125 ms
56,000 KB
testcase_13 AC 126 ms
55,888 KB
testcase_14 AC 125 ms
56,072 KB
testcase_15 AC 185 ms
56,040 KB
testcase_16 AC 187 ms
56,532 KB
testcase_17 AC 188 ms
55,988 KB
testcase_18 AC 153 ms
55,760 KB
testcase_19 AC 188 ms
54,128 KB
testcase_20 AC 185 ms
55,908 KB
testcase_21 AC 156 ms
56,636 KB
testcase_22 AC 188 ms
55,856 KB
testcase_23 AC 167 ms
56,428 KB
testcase_24 AC 153 ms
56,392 KB
testcase_25 AC 189 ms
56,180 KB
testcase_26 AC 189 ms
55,836 KB
testcase_27 AC 192 ms
56,916 KB
testcase_28 AC 138 ms
55,768 KB
testcase_29 AC 181 ms
56,024 KB
testcase_30 AC 137 ms
56,024 KB
testcase_31 AC 187 ms
56,244 KB
testcase_32 AC 147 ms
55,560 KB
testcase_33 AC 187 ms
56,264 KB
testcase_34 AC 138 ms
55,976 KB
testcase_35 AC 185 ms
55,832 KB
testcase_36 AC 168 ms
55,940 KB
testcase_37 AC 144 ms
55,924 KB
testcase_38 AC 156 ms
55,796 KB
testcase_39 AC 155 ms
55,588 KB
testcase_40 AC 191 ms
57,052 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