結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2020-04-08 19:16:18 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 264 bytes |
コンパイル時間 | 36 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-07-19 04:40:03 |
合計ジャッジ時間 | 1,725 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
H, N = gets.split.map(&:to_i) heights = (N - 1).times.map { gets.to_i } heights << H heights.sort! rank = (N - heights.rindex(H)).to_s case rank[-1] when '1' puts rank + 'st' when '2' puts rank + 'nd' when '3' puts rank + 'rd' else puts rank + 'th' end