結果

問題 No.564 背の順
ユーザー Too YoungToo Young
提出日時 2020-07-14 19:02:28
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 424 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 32,276 KB
実行使用メモリ 32,404 KB
最終ジャッジ日時 2024-04-29 07:09:33
合計ジャッジ時間 1,116 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
31,224 KB
testcase_01 AC 36 ms
30,948 KB
testcase_02 AC 37 ms
31,060 KB
testcase_03 WA -
testcase_04 AC 40 ms
30,860 KB
testcase_05 AC 41 ms
31,288 KB
testcase_06 AC 39 ms
31,144 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 40 ms
31,092 KB
testcase_10 AC 39 ms
30,836 KB
testcase_11 AC 37 ms
31,140 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$row1 = explode(" ",trim(fgets(STDIN)));
$rowNum = $row1[1];
$myHeight = $row1[0];
$list[] = $myHeight;
for($i=0; $i < ($rowNum-1); $i++) {
    $row = explode(" ",trim(fgets(STDIN)));
    $list[] = $row[0];
}
rsort($list);
$listFlipped = array_flip($list);
$rank = $listFlipped[$myHeight] + 1;
$surfix = array("st","nd","rd","th");
if($rank > 3) {
    echo $rank.$surfix[3];
} else {
    echo $rank.$surfix[$rank-1];
}
0