結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
ant2357
|
| 提出日時 | 2016-03-26 23:13:27 |
| 言語 | PHP (843.2) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 313 bytes |
| コンパイル時間 | 1,965 ms |
| コンパイル使用メモリ | 31,892 KB |
| 実行使用メモリ | 32,784 KB |
| 最終ジャッジ日時 | 2024-10-02 01:06:05 |
| 合計ジャッジ時間 | 3,566 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 RE * 2 |
| other | WA * 18 RE * 20 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?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);
ant2357