結果

問題 No.275 中央値を求めよ
ユーザー spaciaspacia
提出日時 2015-12-20 10:50:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 54 ms / 1,000 ms
コード長 585 bytes
コンパイル時間 2,455 ms
コンパイル使用メモリ 72,252 KB
実行使用メモリ 50,572 KB
最終ジャッジ日時 2023-09-07 05:06:02
合計ジャッジ時間 6,283 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,412 KB
testcase_01 AC 44 ms
49,336 KB
testcase_02 AC 46 ms
49,424 KB
testcase_03 AC 44 ms
49,436 KB
testcase_04 AC 45 ms
49,428 KB
testcase_05 AC 46 ms
49,620 KB
testcase_06 AC 45 ms
49,320 KB
testcase_07 AC 49 ms
49,332 KB
testcase_08 AC 46 ms
49,224 KB
testcase_09 AC 46 ms
49,372 KB
testcase_10 AC 46 ms
49,312 KB
testcase_11 AC 45 ms
49,448 KB
testcase_12 AC 44 ms
49,360 KB
testcase_13 AC 44 ms
49,300 KB
testcase_14 AC 44 ms
49,316 KB
testcase_15 AC 53 ms
50,572 KB
testcase_16 AC 54 ms
49,432 KB
testcase_17 AC 54 ms
49,544 KB
testcase_18 AC 48 ms
47,400 KB
testcase_19 AC 49 ms
49,336 KB
testcase_20 AC 49 ms
49,764 KB
testcase_21 AC 47 ms
47,832 KB
testcase_22 AC 52 ms
49,432 KB
testcase_23 AC 48 ms
49,484 KB
testcase_24 AC 47 ms
49,324 KB
testcase_25 AC 52 ms
49,528 KB
testcase_26 AC 51 ms
49,500 KB
testcase_27 AC 50 ms
49,372 KB
testcase_28 AC 45 ms
49,240 KB
testcase_29 AC 46 ms
49,316 KB
testcase_30 AC 47 ms
49,292 KB
testcase_31 AC 52 ms
49,352 KB
testcase_32 AC 47 ms
49,696 KB
testcase_33 AC 51 ms
49,988 KB
testcase_34 AC 45 ms
49,220 KB
testcase_35 AC 50 ms
49,348 KB
testcase_36 AC 48 ms
49,744 KB
testcase_37 AC 47 ms
49,492 KB
testcase_38 AC 47 ms
49,304 KB
testcase_39 AC 51 ms
49,428 KB
testcase_40 AC 52 ms
49,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main275 {
	
	public static void out (Object out) {
		System.out.println(out);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] nums = new int[n];
		String[] str = br.readLine().split(" ");
		
		for (int i = 0; i < n; i++)
			nums[i] = Integer.parseInt(str[i]);
		
		Arrays.sort(nums);
		
		if (n % 2 == 0)
			out((nums[n / 2] + nums[n / 2 - 1]) / 2.0);
		else
			out(nums[n / 2]);
		
	}
}
0