結果

問題 No.275 中央値を求めよ
ユーザー core123core123
提出日時 2019-04-16 15:56:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 198 ms / 1,000 ms
コード長 817 bytes
コンパイル時間 2,333 ms
コンパイル使用メモリ 78,516 KB
実行使用メモリ 58,164 KB
最終ジャッジ日時 2023-10-22 07:06:51
合計ジャッジ時間 10,478 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
57,596 KB
testcase_01 AC 136 ms
57,540 KB
testcase_02 AC 151 ms
57,800 KB
testcase_03 AC 135 ms
57,500 KB
testcase_04 AC 133 ms
57,532 KB
testcase_05 AC 133 ms
57,536 KB
testcase_06 AC 146 ms
57,724 KB
testcase_07 AC 192 ms
57,800 KB
testcase_08 AC 150 ms
57,620 KB
testcase_09 AC 150 ms
57,652 KB
testcase_10 AC 152 ms
57,448 KB
testcase_11 AC 133 ms
57,504 KB
testcase_12 AC 134 ms
55,464 KB
testcase_13 AC 134 ms
57,508 KB
testcase_14 AC 133 ms
57,516 KB
testcase_15 AC 195 ms
58,120 KB
testcase_16 AC 188 ms
57,876 KB
testcase_17 AC 195 ms
57,732 KB
testcase_18 AC 168 ms
57,352 KB
testcase_19 AC 196 ms
58,164 KB
testcase_20 AC 185 ms
57,852 KB
testcase_21 AC 186 ms
57,788 KB
testcase_22 AC 192 ms
57,808 KB
testcase_23 AC 188 ms
57,664 KB
testcase_24 AC 160 ms
57,676 KB
testcase_25 AC 197 ms
58,028 KB
testcase_26 AC 182 ms
57,724 KB
testcase_27 AC 186 ms
57,908 KB
testcase_28 AC 144 ms
57,644 KB
testcase_29 AC 186 ms
57,812 KB
testcase_30 AC 147 ms
57,716 KB
testcase_31 AC 192 ms
57,792 KB
testcase_32 AC 152 ms
55,732 KB
testcase_33 AC 192 ms
57,804 KB
testcase_34 AC 144 ms
57,688 KB
testcase_35 AC 189 ms
57,812 KB
testcase_36 AC 181 ms
57,852 KB
testcase_37 AC 152 ms
57,840 KB
testcase_38 AC 159 ms
57,848 KB
testcase_39 AC 162 ms
57,776 KB
testcase_40 AC 198 ms
57,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.stream.*;
public class Main{
	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);
		if(n%2==0){
			put(((a[n/2-1])+a[n/2])/2.0);
		}else{
			put(a[n/2]);
		}
	}
	
	public static void print(Object object){
        System.out.print(object);
    }
    public static void put(Object object) {
        System.out.println(object);
    }
    public static void put(){
        System.out.println();
    }
 
    public static void print(String format,Object... args){
        System.out.print(String.format(format,args));
    }
    public static void put(String format,Object... args) {
        System.out.println(String.format(format,args));
    }
}
0