結果

問題 No.275 中央値を求めよ
ユーザー togaerrortogaerror
提出日時 2015-09-08 22:31:20
言語 Perl
(5.26.3)
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 292 bytes
コンパイル時間 209 ms
使用メモリ 5,388 KB
最終ジャッジ日時 2023-01-22 20:08:47
合計ジャッジ時間 1,960 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 5 ms
4,992 KB
testcase_01 AC 5 ms
5,188 KB
testcase_02 AC 5 ms
5,144 KB
testcase_03 AC 5 ms
5,004 KB
testcase_04 AC 4 ms
5,076 KB
testcase_05 AC 4 ms
5,292 KB
testcase_06 AC 4 ms
5,160 KB
testcase_07 AC 4 ms
5,076 KB
testcase_08 AC 4 ms
4,900 KB
testcase_09 AC 5 ms
5,008 KB
testcase_10 AC 4 ms
5,148 KB
testcase_11 AC 5 ms
5,156 KB
testcase_12 AC 4 ms
5,000 KB
testcase_13 AC 5 ms
5,236 KB
testcase_14 AC 4 ms
4,936 KB
testcase_15 AC 5 ms
5,128 KB
testcase_16 AC 4 ms
5,048 KB
testcase_17 AC 5 ms
5,188 KB
testcase_18 AC 4 ms
5,132 KB
testcase_19 AC 4 ms
4,888 KB
testcase_20 AC 5 ms
5,160 KB
testcase_21 AC 5 ms
5,296 KB
testcase_22 AC 5 ms
5,156 KB
testcase_23 AC 5 ms
5,124 KB
testcase_24 AC 5 ms
5,280 KB
testcase_25 AC 5 ms
5,328 KB
testcase_26 AC 5 ms
5,208 KB
testcase_27 AC 5 ms
4,888 KB
testcase_28 AC 5 ms
5,004 KB
testcase_29 AC 5 ms
5,008 KB
testcase_30 AC 5 ms
4,936 KB
testcase_31 AC 5 ms
5,388 KB
testcase_32 AC 4 ms
4,948 KB
testcase_33 AC 5 ms
5,260 KB
testcase_34 AC 5 ms
5,124 KB
testcase_35 AC 5 ms
4,948 KB
testcase_36 AC 4 ms
5,008 KB
testcase_37 AC 4 ms
5,280 KB
testcase_38 AC 5 ms
5,160 KB
testcase_39 AC 5 ms
4,920 KB
testcase_40 AC 4 ms
5,216 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