結果

問題 No.275 中央値を求めよ
ユーザー core123core123
提出日時 2019-04-16 15:55:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 819 bytes
コンパイル時間 2,357 ms
コンパイル使用メモリ 79,040 KB
実行使用メモリ 58,344 KB
最終ジャッジ日時 2023-10-22 07:06:38
合計ジャッジ時間 10,574 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
57,624 KB
testcase_01 AC 132 ms
57,612 KB
testcase_02 AC 144 ms
57,728 KB
testcase_03 WA -
testcase_04 AC 130 ms
57,532 KB
testcase_05 AC 132 ms
57,544 KB
testcase_06 AC 144 ms
57,712 KB
testcase_07 AC 183 ms
57,660 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 149 ms
57,844 KB
testcase_11 RE -
testcase_12 AC 132 ms
57,548 KB
testcase_13 WA -
testcase_14 AC 129 ms
57,292 KB
testcase_15 AC 186 ms
57,752 KB
testcase_16 AC 190 ms
57,724 KB
testcase_17 AC 193 ms
57,852 KB
testcase_18 AC 169 ms
57,852 KB
testcase_19 AC 183 ms
57,724 KB
testcase_20 AC 181 ms
57,828 KB
testcase_21 AC 181 ms
57,820 KB
testcase_22 AC 190 ms
55,676 KB
testcase_23 WA -
testcase_24 AC 155 ms
57,752 KB
testcase_25 AC 188 ms
57,696 KB
testcase_26 WA -
testcase_27 AC 188 ms
57,732 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 191 ms
57,892 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 152 ms
57,740 KB
testcase_38 AC 158 ms
57,716 KB
testcase_39 AC 164 ms
57,860 KB
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

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-1]);
		}
	}
	
	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