結果

問題 No.275 中央値を求めよ
ユーザー GrenacheGrenache
提出日時 2015-09-04 22:24:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 201 ms / 1,000 ms
コード長 574 bytes
コンパイル時間 3,691 ms
コンパイル使用メモリ 72,820 KB
実行使用メモリ 57,096 KB
最終ジャッジ日時 2023-09-07 04:33:11
合計ジャッジ時間 11,921 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
55,924 KB
testcase_01 AC 131 ms
55,932 KB
testcase_02 AC 146 ms
55,828 KB
testcase_03 AC 131 ms
55,600 KB
testcase_04 AC 132 ms
56,136 KB
testcase_05 AC 132 ms
55,608 KB
testcase_06 AC 145 ms
55,912 KB
testcase_07 AC 191 ms
56,372 KB
testcase_08 AC 151 ms
55,668 KB
testcase_09 AC 150 ms
56,092 KB
testcase_10 AC 149 ms
53,872 KB
testcase_11 AC 131 ms
55,956 KB
testcase_12 AC 135 ms
55,720 KB
testcase_13 AC 132 ms
56,292 KB
testcase_14 AC 134 ms
55,892 KB
testcase_15 AC 201 ms
56,280 KB
testcase_16 AC 198 ms
57,096 KB
testcase_17 AC 195 ms
56,924 KB
testcase_18 AC 159 ms
56,016 KB
testcase_19 AC 190 ms
56,316 KB
testcase_20 AC 197 ms
57,084 KB
testcase_21 AC 159 ms
55,992 KB
testcase_22 AC 194 ms
56,620 KB
testcase_23 AC 183 ms
56,688 KB
testcase_24 AC 159 ms
56,008 KB
testcase_25 AC 192 ms
56,020 KB
testcase_26 AC 197 ms
56,100 KB
testcase_27 AC 194 ms
56,908 KB
testcase_28 AC 141 ms
56,172 KB
testcase_29 AC 159 ms
56,116 KB
testcase_30 AC 141 ms
56,016 KB
testcase_31 AC 193 ms
56,480 KB
testcase_32 AC 150 ms
56,440 KB
testcase_33 AC 194 ms
56,632 KB
testcase_34 AC 145 ms
56,240 KB
testcase_35 AC 190 ms
56,352 KB
testcase_36 AC 157 ms
56,160 KB
testcase_37 AC 146 ms
55,996 KB
testcase_38 AC 157 ms
55,908 KB
testcase_39 AC 157 ms
56,284 KB
testcase_40 AC 197 ms
56,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


public class Main_yukicoder275 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
        	a[i] = sc.nextInt();
        }
        Arrays.sort(a);

        double ret;
        if (n % 2 != 0) {
        	ret = a[n / 2];
        } else {
        	ret = ((double)a[n / 2] + a[n / 2 - 1]) / 2;
        }
        
        System.out.printf("%.2f\n", ret);

        sc.close();
    }
}
0