結果

問題 No.564 背の順
ユーザー tazakkytazakky
提出日時 2017-09-08 22:41:55
言語 PHP
(8.3.4)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 673 bytes
コンパイル時間 3,635 ms
コンパイル使用メモリ 30,668 KB
実行使用メモリ 31,524 KB
最終ジャッジ日時 2024-04-25 02:36:21
合計ジャッジ時間 4,370 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
31,364 KB
testcase_01 AC 44 ms
31,524 KB
testcase_02 AC 43 ms
31,400 KB
testcase_03 AC 44 ms
31,292 KB
testcase_04 AC 46 ms
31,228 KB
testcase_05 AC 43 ms
31,364 KB
testcase_06 AC 45 ms
31,188 KB
testcase_07 AC 41 ms
31,016 KB
testcase_08 AC 42 ms
31,352 KB
testcase_09 AC 45 ms
31,340 KB
testcase_10 AC 43 ms
31,320 KB
testcase_11 AC 43 ms
31,292 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
    // 1行目には,なま君の身長HH(1≦H≦10001≦H≦1000)とクラスの人数NN(2≦N≦1002≦N≦100)
    list($nama, $n) = explode(" ", trim(fgets(STDIN)));
    for($i = 0; $i < $n-1; $i++){
        $talls[] = trim(fgets(STDIN));
    }
    rsort($talls);
    $no = 1;
    for($i = 0; $i < $n-1; $i++){
        if($talls[$i] > $nama){
            $no++;
        }else{
            break;
        }
    }
    
    if(preg_match('/1$/', $no )){
        echo $no."st\n";
    }elseif(preg_match('/2$/', $no )){
        echo $no."nd\n";
    }elseif(preg_match('/3$/', $no )){
        echo $no."rd\n";
    }else{
        echo $no."th\n";
    }
   
?>
0