結果

問題 No.275 中央値を求めよ
ユーザー ottfoekstottfoekst
提出日時 2015-11-15 00:16:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 195 ms / 1,000 ms
コード長 538 bytes
コンパイル時間 3,886 ms
コンパイル使用メモリ 72,280 KB
実行使用メモリ 57,800 KB
最終ジャッジ日時 2023-09-07 05:01:15
合計ジャッジ時間 12,439 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,840 KB
testcase_01 AC 128 ms
56,188 KB
testcase_02 AC 142 ms
54,064 KB
testcase_03 AC 126 ms
55,920 KB
testcase_04 AC 127 ms
56,256 KB
testcase_05 AC 128 ms
55,628 KB
testcase_06 AC 138 ms
56,208 KB
testcase_07 AC 185 ms
56,108 KB
testcase_08 AC 144 ms
57,800 KB
testcase_09 AC 149 ms
56,004 KB
testcase_10 AC 147 ms
56,148 KB
testcase_11 AC 127 ms
55,876 KB
testcase_12 AC 127 ms
55,552 KB
testcase_13 AC 127 ms
56,052 KB
testcase_14 AC 128 ms
56,188 KB
testcase_15 AC 192 ms
56,292 KB
testcase_16 AC 190 ms
56,072 KB
testcase_17 AC 191 ms
56,240 KB
testcase_18 AC 154 ms
55,992 KB
testcase_19 AC 174 ms
55,780 KB
testcase_20 AC 189 ms
55,596 KB
testcase_21 AC 174 ms
56,064 KB
testcase_22 AC 188 ms
55,796 KB
testcase_23 AC 162 ms
56,396 KB
testcase_24 AC 157 ms
55,756 KB
testcase_25 AC 195 ms
56,336 KB
testcase_26 AC 191 ms
56,420 KB
testcase_27 AC 185 ms
56,048 KB
testcase_28 AC 139 ms
55,740 KB
testcase_29 AC 160 ms
56,104 KB
testcase_30 AC 141 ms
56,256 KB
testcase_31 AC 193 ms
56,064 KB
testcase_32 AC 147 ms
55,808 KB
testcase_33 AC 189 ms
56,252 KB
testcase_34 AC 141 ms
55,856 KB
testcase_35 AC 189 ms
55,736 KB
testcase_36 AC 172 ms
56,008 KB
testcase_37 AC 144 ms
55,872 KB
testcase_38 AC 157 ms
56,204 KB
testcase_39 AC 152 ms
55,804 KB
testcase_40 AC 183 ms
55,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class No275 {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] noList = new int[scanner.nextInt()];
		for(int index = 0; index < noList.length; index++) {
			noList[index] = scanner.nextInt();
		}
		Arrays.sort(noList);
		if(noList.length % 2 == 1) {
			System.out.println(noList[noList.length / 2]);
		}
		else {
			System.out.println((noList[(noList.length / 2) - 1] + noList[noList.length / 2]) / 2.0);
		}
		scanner.close();
	}
}
0