結果

問題 No.564 背の順
ユーザー papinianuspapinianus
提出日時 2017-09-08 23:44:59
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 1,896 ms
コンパイル使用メモリ 30,476 KB
実行使用メモリ 31,244 KB
最終ジャッジ日時 2024-04-25 02:42:25
合計ジャッジ時間 2,994 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
30,856 KB
testcase_01 AC 42 ms
31,108 KB
testcase_02 AC 41 ms
31,244 KB
testcase_03 WA -
testcase_04 AC 41 ms
31,172 KB
testcase_05 AC 40 ms
31,004 KB
testcase_06 AC 40 ms
31,012 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 40 ms
30,844 KB
testcase_10 AC 41 ms
31,048 KB
testcase_11 AC 41 ms
31,164 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?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($pos) {
    case 1:
        echo "1st";
        break;
    case 2:
        echo "2nd";
        break;
    case 3:
        echo "3rd";
        break;
    default:
        echo $pos."th";
        break;
}
echo PHP_EOL;
0