結果

問題 No.275 中央値を求めよ
ユーザー togaerrortogaerror
提出日時 2015-09-08 22:31:20
言語 Perl
(5.38.0)
結果
AC  
実行時間 6 ms / 1,000 ms
コード長 292 bytes
コンパイル時間 563 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 5,240 KB
最終ジャッジ日時 2023-09-07 04:43:02
合計ジャッジ時間 2,499 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,888 KB
testcase_01 AC 5 ms
5,080 KB
testcase_02 AC 5 ms
4,956 KB
testcase_03 AC 5 ms
4,760 KB
testcase_04 AC 5 ms
5,108 KB
testcase_05 AC 5 ms
4,896 KB
testcase_06 AC 5 ms
5,004 KB
testcase_07 AC 5 ms
5,088 KB
testcase_08 AC 5 ms
4,948 KB
testcase_09 AC 5 ms
5,072 KB
testcase_10 AC 5 ms
4,908 KB
testcase_11 AC 5 ms
5,080 KB
testcase_12 AC 5 ms
4,788 KB
testcase_13 AC 5 ms
5,016 KB
testcase_14 AC 5 ms
4,908 KB
testcase_15 AC 5 ms
5,140 KB
testcase_16 AC 5 ms
4,968 KB
testcase_17 AC 5 ms
4,944 KB
testcase_18 AC 6 ms
5,044 KB
testcase_19 AC 5 ms
4,820 KB
testcase_20 AC 5 ms
5,232 KB
testcase_21 AC 5 ms
5,008 KB
testcase_22 AC 5 ms
5,000 KB
testcase_23 AC 5 ms
5,084 KB
testcase_24 AC 5 ms
4,912 KB
testcase_25 AC 6 ms
5,240 KB
testcase_26 AC 5 ms
4,940 KB
testcase_27 AC 5 ms
4,972 KB
testcase_28 AC 5 ms
5,080 KB
testcase_29 AC 5 ms
5,068 KB
testcase_30 AC 5 ms
4,904 KB
testcase_31 AC 5 ms
4,920 KB
testcase_32 AC 5 ms
5,088 KB
testcase_33 AC 5 ms
4,904 KB
testcase_34 AC 5 ms
4,760 KB
testcase_35 AC 5 ms
4,796 KB
testcase_36 AC 5 ms
4,980 KB
testcase_37 AC 5 ms
4,968 KB
testcase_38 AC 5 ms
4,912 KB
testcase_39 AC 5 ms
4,884 KB
testcase_40 AC 5 ms
5,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;

my $n = <>;
my $line = <>;
chomp $line;
my @array = split / /, $line;

@array = sort {$a <=> $b} @array;
my $ans;

if($n % 2 == 0) {
	$ans = $array[$n / 2];
	$ans += $array[($n / 2) - 1];
	$ans /= 2;
} else {
	$ans = $array[($n - 1) / 2];
}

print "$ans\n";

exit;
0