結果

問題 No.275 中央値を求めよ
ユーザー cande398cande398
提出日時 2017-10-11 16:53:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 190 ms / 1,000 ms
コード長 418 bytes
コンパイル時間 2,277 ms
コンパイル使用メモリ 71,144 KB
実行使用メモリ 56,740 KB
最終ジャッジ日時 2023-09-07 06:18:06
合計ジャッジ時間 10,024 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,540 KB
testcase_01 AC 123 ms
55,724 KB
testcase_02 AC 139 ms
55,608 KB
testcase_03 AC 125 ms
55,600 KB
testcase_04 AC 129 ms
55,560 KB
testcase_05 AC 126 ms
55,592 KB
testcase_06 AC 135 ms
55,628 KB
testcase_07 AC 170 ms
56,452 KB
testcase_08 AC 141 ms
55,384 KB
testcase_09 AC 140 ms
55,552 KB
testcase_10 AC 143 ms
55,796 KB
testcase_11 AC 125 ms
55,552 KB
testcase_12 AC 123 ms
53,704 KB
testcase_13 AC 123 ms
55,536 KB
testcase_14 AC 124 ms
55,368 KB
testcase_15 AC 185 ms
55,960 KB
testcase_16 AC 190 ms
55,968 KB
testcase_17 AC 189 ms
55,868 KB
testcase_18 AC 166 ms
55,620 KB
testcase_19 AC 182 ms
55,744 KB
testcase_20 AC 188 ms
56,716 KB
testcase_21 AC 159 ms
55,628 KB
testcase_22 AC 188 ms
55,800 KB
testcase_23 AC 180 ms
55,860 KB
testcase_24 AC 151 ms
55,996 KB
testcase_25 AC 188 ms
56,308 KB
testcase_26 AC 190 ms
56,344 KB
testcase_27 AC 187 ms
56,192 KB
testcase_28 AC 137 ms
55,540 KB
testcase_29 AC 180 ms
56,740 KB
testcase_30 AC 136 ms
55,464 KB
testcase_31 AC 188 ms
56,124 KB
testcase_32 AC 143 ms
55,828 KB
testcase_33 AC 185 ms
56,120 KB
testcase_34 AC 140 ms
55,588 KB
testcase_35 AC 187 ms
55,888 KB
testcase_36 AC 179 ms
56,068 KB
testcase_37 AC 145 ms
55,412 KB
testcase_38 AC 153 ms
55,796 KB
testcase_39 AC 163 ms
55,748 KB
testcase_40 AC 187 ms
56,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
    public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
       int num = sc.nextInt();
       int[] line = new int[num];
       for(int i=0;i<num;i++){
           line[i] = sc.nextInt();
       }
       Arrays.sort(line);
       if(num%2==0)System.out.println((line[num/2]+line[num/2-1])/2.0);
       else System.out.println(line[num/2]);
    }
}
0