結果

問題 No.275 中央値を求めよ
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-09-04 22:23:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 202 ms / 1,000 ms
コード長 744 bytes
コンパイル時間 3,863 ms
コンパイル使用メモリ 74,336 KB
実行使用メモリ 59,012 KB
最終ジャッジ日時 2023-09-07 04:32:57
合計ジャッジ時間 12,084 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
56,228 KB
testcase_01 AC 134 ms
55,608 KB
testcase_02 AC 149 ms
55,784 KB
testcase_03 AC 131 ms
56,060 KB
testcase_04 AC 131 ms
55,980 KB
testcase_05 AC 132 ms
55,820 KB
testcase_06 AC 143 ms
56,024 KB
testcase_07 AC 198 ms
55,804 KB
testcase_08 AC 154 ms
55,788 KB
testcase_09 AC 150 ms
54,364 KB
testcase_10 AC 152 ms
56,284 KB
testcase_11 AC 131 ms
56,024 KB
testcase_12 AC 135 ms
56,028 KB
testcase_13 AC 132 ms
55,868 KB
testcase_14 AC 136 ms
56,288 KB
testcase_15 AC 199 ms
56,580 KB
testcase_16 AC 202 ms
56,576 KB
testcase_17 AC 199 ms
56,928 KB
testcase_18 AC 159 ms
56,340 KB
testcase_19 AC 200 ms
56,472 KB
testcase_20 AC 200 ms
56,288 KB
testcase_21 AC 161 ms
56,364 KB
testcase_22 AC 198 ms
57,372 KB
testcase_23 AC 178 ms
56,048 KB
testcase_24 AC 159 ms
56,056 KB
testcase_25 AC 199 ms
56,220 KB
testcase_26 AC 197 ms
59,012 KB
testcase_27 AC 198 ms
56,388 KB
testcase_28 AC 142 ms
55,624 KB
testcase_29 AC 177 ms
56,824 KB
testcase_30 AC 143 ms
55,920 KB
testcase_31 AC 196 ms
56,592 KB
testcase_32 AC 150 ms
56,856 KB
testcase_33 AC 200 ms
56,652 KB
testcase_34 AC 143 ms
56,340 KB
testcase_35 AC 200 ms
56,420 KB
testcase_36 AC 170 ms
56,196 KB
testcase_37 AC 148 ms
56,128 KB
testcase_38 AC 158 ms
56,216 KB
testcase_39 AC 159 ms
56,108 KB
testcase_40 AC 195 ms
56,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class No0275 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = in.nextInt();
		}

		Arrays.sort(a);
		out.printf("%3f\n",(n%2 == 0 ? (double)(a[n/2]+a[n/2-1])/2 : a[n/2]));
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}
0