結果

問題 No.564 背の順
ユーザー TANIGUCHI Kousuke
提出日時 2019-11-01 13:14:29
言語 Ruby
(3.4.1)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-09-14 22:36:23
合計ジャッジ時間 1,810 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def order(n)
  case n % 10
  when 1; "#{n}st"
  when 2; "#{n}nd"
  when 3; "#{n}rd"
  else; "#{n}th"
  end
end

H, N = gets.split.map(&:to_i)
S = Array.new(N + 1, H)
(1 .. N).each{|i|S[i] = gets.to_i}
S.sort!.reverse!
puts order(S.index(H) + 1)
0