結果

問題 No.564 背の順
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2019-11-01 13:14:29
言語 Ruby
(3.3.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 11,448 KB
実行使用メモリ 15,296 KB
最終ジャッジ日時 2023-10-13 00:41:10
合計ジャッジ時間 1,883 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,292 KB
testcase_01 AC 87 ms
15,120 KB
testcase_02 AC 81 ms
15,252 KB
testcase_03 AC 84 ms
15,292 KB
testcase_04 AC 83 ms
15,296 KB
testcase_05 AC 81 ms
15,172 KB
testcase_06 AC 81 ms
15,040 KB
testcase_07 AC 81 ms
15,052 KB
testcase_08 AC 81 ms
15,288 KB
testcase_09 AC 80 ms
15,272 KB
testcase_10 AC 82 ms
15,248 KB
testcase_11 AC 82 ms
15,240 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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