結果

問題 No.275 中央値を求めよ
ユーザー TakaTaka
提出日時 2016-11-04 16:35:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 270 ms / 1,000 ms
コード長 386 bytes
コンパイル時間 2,666 ms
コンパイル使用メモリ 71,888 KB
実行使用メモリ 62,364 KB
最終ジャッジ日時 2023-09-07 05:41:01
合計ジャッジ時間 12,495 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
56,304 KB
testcase_01 AC 139 ms
56,164 KB
testcase_02 AC 171 ms
56,240 KB
testcase_03 AC 141 ms
56,328 KB
testcase_04 AC 141 ms
56,060 KB
testcase_05 AC 144 ms
56,068 KB
testcase_06 AC 169 ms
56,516 KB
testcase_07 AC 237 ms
58,324 KB
testcase_08 AC 207 ms
56,284 KB
testcase_09 AC 211 ms
56,832 KB
testcase_10 AC 213 ms
56,772 KB
testcase_11 AC 140 ms
55,944 KB
testcase_12 AC 141 ms
55,684 KB
testcase_13 AC 141 ms
56,164 KB
testcase_14 AC 142 ms
55,664 KB
testcase_15 AC 261 ms
61,584 KB
testcase_16 AC 268 ms
61,348 KB
testcase_17 AC 264 ms
61,160 KB
testcase_18 AC 227 ms
59,288 KB
testcase_19 AC 235 ms
60,284 KB
testcase_20 AC 245 ms
60,752 KB
testcase_21 AC 237 ms
60,248 KB
testcase_22 AC 269 ms
60,176 KB
testcase_23 AC 244 ms
60,140 KB
testcase_24 AC 221 ms
60,364 KB
testcase_25 AC 261 ms
62,216 KB
testcase_26 AC 257 ms
60,928 KB
testcase_27 AC 252 ms
60,620 KB
testcase_28 AC 170 ms
56,316 KB
testcase_29 AC 236 ms
60,032 KB
testcase_30 AC 176 ms
56,024 KB
testcase_31 AC 265 ms
61,112 KB
testcase_32 AC 212 ms
57,884 KB
testcase_33 AC 247 ms
60,712 KB
testcase_34 AC 170 ms
56,216 KB
testcase_35 AC 244 ms
59,888 KB
testcase_36 AC 227 ms
58,688 KB
testcase_37 AC 208 ms
56,492 KB
testcase_38 AC 218 ms
59,952 KB
testcase_39 AC 223 ms
60,044 KB
testcase_40 AC 270 ms
62,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
class map{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		double ar[]=new double[a];
		for(int i=0; i<a; i++){
			ar[i]=sc.nextDouble();
		}
		double ans=0;
		Arrays.sort(ar);
		if(a%2==0){
			ans=(ar[a/2-1]+ar[a/2])/2;
		}else{
			ans=ar[a/2];
		}
		System.out.println(ans);
	}
}
0