結果
| 問題 | No.564 背の順 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-09-08 23:49:23 |
| 言語 | PHP (843.2) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| コード長 | 451 bytes |
| コンパイル時間 | 440 ms |
| コンパイル使用メモリ | 31,008 KB |
| 実行使用メモリ | 31,064 KB |
| 最終ジャッジ日時 | 2024-11-07 12:19:49 |
| 合計ジャッジ時間 | 1,540 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php
list($h, $n) = explode(" ", trim(fgets(STDIN)));
$n--;
$heights = [$h];
while($n) {
$n--;
$heights[] = trim(fgets(STDIN));
}
rsort($heights);
$pos = array_search($h, $heights) + 1;
switch(substr($pos."", -1)) {
case "1":
echo $pos."st";
break;
case "2":
echo $pos."nd";
break;
case "3":
echo $pos."rd";
break;
default:
echo $pos."th";
break;
}
echo PHP_EOL;