結果

問題 No.275 中央値を求めよ
ユーザー 37zigen37zigen
提出日時 2016-03-29 13:23:16
言語 Java19
(openjdk 21)
結果
AC  
実行時間 274 ms / 1,000 ms
コード長 450 bytes
コンパイル時間 2,367 ms
コンパイル使用メモリ 71,708 KB
実行使用メモリ 61,696 KB
最終ジャッジ日時 2023-09-07 05:18:48
合計ジャッジ時間 13,532 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
55,924 KB
testcase_01 AC 142 ms
55,756 KB
testcase_02 AC 190 ms
56,284 KB
testcase_03 AC 142 ms
56,212 KB
testcase_04 AC 145 ms
56,388 KB
testcase_05 AC 142 ms
55,980 KB
testcase_06 AC 176 ms
56,092 KB
testcase_07 AC 247 ms
60,104 KB
testcase_08 AC 212 ms
56,240 KB
testcase_09 AC 211 ms
56,024 KB
testcase_10 AC 211 ms
56,564 KB
testcase_11 AC 144 ms
55,988 KB
testcase_12 AC 144 ms
56,088 KB
testcase_13 AC 148 ms
56,132 KB
testcase_14 AC 146 ms
55,960 KB
testcase_15 AC 268 ms
61,380 KB
testcase_16 AC 273 ms
61,248 KB
testcase_17 AC 270 ms
61,016 KB
testcase_18 AC 237 ms
59,936 KB
testcase_19 AC 253 ms
60,168 KB
testcase_20 AC 245 ms
60,160 KB
testcase_21 AC 243 ms
59,732 KB
testcase_22 AC 270 ms
60,704 KB
testcase_23 AC 247 ms
60,440 KB
testcase_24 AC 227 ms
59,496 KB
testcase_25 AC 268 ms
61,696 KB
testcase_26 AC 265 ms
61,216 KB
testcase_27 AC 249 ms
59,628 KB
testcase_28 AC 182 ms
56,080 KB
testcase_29 AC 243 ms
60,368 KB
testcase_30 AC 182 ms
56,356 KB
testcase_31 AC 270 ms
59,988 KB
testcase_32 AC 219 ms
55,824 KB
testcase_33 AC 261 ms
60,564 KB
testcase_34 AC 179 ms
56,188 KB
testcase_35 AC 260 ms
60,636 KB
testcase_36 AC 242 ms
60,384 KB
testcase_37 AC 222 ms
57,340 KB
testcase_38 AC 232 ms
59,484 KB
testcase_39 AC 227 ms
59,932 KB
testcase_40 AC 274 ms
61,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder275;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		double[] a=new double[n+1];
		a[0]=-99999999;
		
		for(int i=1;i<=n;i++){
			a[i]=sc.nextDouble();
		}
		Arrays.sort(a);
		if(n%2==0){
			System.out.println((a[n/2]+a[n/2+1])/2);
		}else if(n%2==1){
			System.out.println(a[n/2+1]);
		}
		sc.close();
	}
}
0