結果

問題 No.275 中央値を求めよ
ユーザー ant2357ant2357
提出日時 2016-03-26 23:13:27
言語 PHP
(8.3.4)
結果
RE  
実行時間 -
コード長 313 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 32,272 KB
実行使用メモリ 32,788 KB
最終ジャッジ日時 2024-04-10 00:06:10
合計ジャッジ時間 2,697 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 WA -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 WA -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 RE -
testcase_38 RE -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$input = trim(fgets(STDIN));
$input2[] = explode(" ", trim(fgets(STDIN)));

sort($input2);

if ($input % 2 == 0) {
	//偶数
	$ans = (($input2[(count($input2) / 2) - 1] + $input2[((count($input2) / 2))]) / 2);
} else {
	//奇数
	$ans = ($input2[floor(count($input2) / 2)]);
}

//出力
echo ($ans.PHP_EOL);
0