結果

問題 No.564 背の順
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2018-01-16 21:15:42
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,332 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2023-08-25 19:52:44
合計ジャッジ時間 1,865 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 77 ms
15,360 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 79 ms
15,132 KB
testcase_06 AC 77 ms
15,196 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 77 ms
15,244 KB
testcase_11 AC 76 ms
15,072 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

H, _ = gets.split.map(&:to_i)

h = readlines.map(&:to_i).sort_by(&:-@)
rank = ((h.index(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}"
0