結果

問題 No.275 中央値を求めよ
ユーザー FVRChanFVRChan
提出日時 2017-10-02 21:05:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 195 ms / 1,000 ms
コード長 447 bytes
コンパイル時間 2,594 ms
コンパイル使用メモリ 71,696 KB
実行使用メモリ 56,580 KB
最終ジャッジ日時 2023-09-07 06:17:52
合計ジャッジ時間 10,379 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,528 KB
testcase_01 AC 133 ms
53,584 KB
testcase_02 AC 142 ms
55,596 KB
testcase_03 AC 126 ms
55,420 KB
testcase_04 AC 124 ms
55,616 KB
testcase_05 AC 128 ms
55,588 KB
testcase_06 AC 138 ms
55,584 KB
testcase_07 AC 183 ms
56,016 KB
testcase_08 AC 145 ms
55,580 KB
testcase_09 AC 146 ms
55,944 KB
testcase_10 AC 145 ms
55,428 KB
testcase_11 AC 126 ms
55,408 KB
testcase_12 AC 126 ms
55,408 KB
testcase_13 AC 124 ms
55,796 KB
testcase_14 AC 127 ms
55,680 KB
testcase_15 AC 187 ms
56,268 KB
testcase_16 AC 189 ms
56,200 KB
testcase_17 AC 189 ms
56,352 KB
testcase_18 AC 162 ms
55,864 KB
testcase_19 AC 188 ms
56,092 KB
testcase_20 AC 185 ms
55,956 KB
testcase_21 AC 173 ms
55,824 KB
testcase_22 AC 182 ms
56,360 KB
testcase_23 AC 171 ms
56,264 KB
testcase_24 AC 153 ms
55,828 KB
testcase_25 AC 192 ms
56,580 KB
testcase_26 AC 185 ms
56,564 KB
testcase_27 AC 177 ms
56,248 KB
testcase_28 AC 139 ms
55,384 KB
testcase_29 AC 160 ms
55,856 KB
testcase_30 AC 140 ms
55,752 KB
testcase_31 AC 189 ms
56,028 KB
testcase_32 AC 143 ms
55,416 KB
testcase_33 AC 189 ms
56,052 KB
testcase_34 AC 139 ms
55,752 KB
testcase_35 AC 188 ms
55,636 KB
testcase_36 AC 185 ms
55,760 KB
testcase_37 AC 145 ms
54,008 KB
testcase_38 AC 157 ms
55,832 KB
testcase_39 AC 158 ms
56,300 KB
testcase_40 AC 195 ms
55,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
public class Main{
	private static Scanner sc=new Scanner(System.in);
	public static void main(String args[])throws Exception{
		int n=sc.nextInt();
		int are[]=new int[n];
		for(int i=0;i<n;i++)are[i]=sc.nextInt();
		Arrays.sort(are);
		if(are.length%2==1)System.out.println(are[are.length/2]);
		else {
			int res=are[are.length/2-1]+are[are.length/2];
			System.out.println(res/2.0);
		};
	}
}
0