結果

問題 No.564 背の順
ユーザー mizzsig
提出日時 2018-02-04 16:02:44
言語 PHP
(843.2)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 2,620 ms
コンパイル使用メモリ 32,144 KB
実行使用メモリ 32,404 KB
最終ジャッジ日時 2024-06-30 03:57:34
合計ジャッジ時間 996 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?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