結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2016-03-26 23:15:12 |
言語 | PHP (843.2) |
結果 |
AC
|
実行時間 | 45 ms / 1,000 ms |
コード長 | 311 bytes |
コンパイル時間 | 2,644 ms |
コンパイル使用メモリ | 30,364 KB |
実行使用メモリ | 31,216 KB |
最終ジャッジ日時 | 2024-06-24 23:46:12 |
合計ジャッジ時間 | 5,736 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
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);