結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-01-16 21:21:38 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 99 ms / 2,000 ms | 
| コード長 | 341 bytes | 
| コンパイル時間 | 39 ms | 
| コンパイル使用メモリ | 7,296 KB | 
| 実行使用メモリ | 12,160 KB | 
| 最終ジャッジ日時 | 2024-12-24 05:53:53 | 
| 合計ジャッジ時間 | 1,987 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
コンパイルメッセージ
Syntax OK
ソースコード
H, _ = gets.split.map(&:to_i)
h = readlines.map(&:to_i).sort_by(&:-@)
rank = ((h.index { |_h| _h <= H } || (H > h.first ? 0 : h.length)) + 1).to_s
suffix = case rank
         when /1$/
           'st'
         when /2$/
           'nd'
         when /3$/
           'rd'
         else
           'th'
         end
puts "#{rank}#{suffix}"
            
            
            
        