結果

問題 No.564 背の順
ユーザー mizzsig
提出日時 2018-02-04 16:02:44
言語 PHP
(8.5.12)
コンパイル:
php -l _filename_
実行:
php _filename_
結果
AC  
実行時間 46 ms / 2,000 ms
+ 73µs
コード長 353 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,471 ms
コンパイル使用メモリ 37,768 KB
実行使用メモリ 38,020 KB
最終ジャッジ日時 2026-10-15 18:29:26
合計ジャッジ時間 4,615 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #
raw source code

<?php
    $n = trim(fgets(STDIN));
    list($nama, $n) = explode(' ', $n);
    $lastWords = ['th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'];
    $ans = 1;

    for ($i = 1; $i < $n; $i++) {
        $enemy = trim(fgets(STDIN));

        if ($enemy > $nama) {
            $ans++;
        }
    }

    echo $ans . $lastWords[$ans % 10] . "\n";
0