結果

問題 No.275 中央値を求めよ
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-09-04 22:23:58
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 194 ms / 1,000 ms
コード長 744 bytes
コンパイル時間 3,639 ms
使用メモリ 41,432 KB
最終ジャッジ日時 2023-01-22 19:52:35
合計ジャッジ時間 11,040 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 105 ms
38,204 KB
testcase_01 AC 105 ms
38,040 KB
testcase_02 AC 112 ms
38,408 KB
testcase_03 AC 104 ms
38,312 KB
testcase_04 AC 108 ms
38,116 KB
testcase_05 AC 108 ms
38,204 KB
testcase_06 AC 114 ms
38,424 KB
testcase_07 AC 147 ms
39,332 KB
testcase_08 AC 119 ms
38,308 KB
testcase_09 AC 127 ms
38,512 KB
testcase_10 AC 122 ms
38,436 KB
testcase_11 AC 107 ms
38,272 KB
testcase_12 AC 110 ms
38,096 KB
testcase_13 AC 105 ms
38,308 KB
testcase_14 AC 103 ms
38,080 KB
testcase_15 AC 179 ms
41,256 KB
testcase_16 AC 191 ms
41,388 KB
testcase_17 AC 183 ms
41,248 KB
testcase_18 AC 129 ms
38,880 KB
testcase_19 AC 154 ms
39,560 KB
testcase_20 AC 156 ms
40,924 KB
testcase_21 AC 125 ms
38,444 KB
testcase_22 AC 182 ms
41,320 KB
testcase_23 AC 143 ms
39,180 KB
testcase_24 AC 126 ms
38,476 KB
testcase_25 AC 194 ms
41,136 KB
testcase_26 AC 160 ms
41,104 KB
testcase_27 AC 167 ms
40,756 KB
testcase_28 AC 110 ms
38,420 KB
testcase_29 AC 132 ms
39,204 KB
testcase_30 AC 119 ms
39,164 KB
testcase_31 AC 179 ms
41,432 KB
testcase_32 AC 118 ms
38,732 KB
testcase_33 AC 157 ms
40,536 KB
testcase_34 AC 116 ms
38,476 KB
testcase_35 AC 168 ms
41,088 KB
testcase_36 AC 139 ms
39,696 KB
testcase_37 AC 121 ms
38,996 KB
testcase_38 AC 128 ms
39,252 KB
testcase_39 AC 130 ms
38,524 KB
testcase_40 AC 189 ms
41,276 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