結果

問題 No.564 背の順
ユーザー object1234object1234
提出日時 2019-02-22 23:44:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 11,368 KB
実行使用メモリ 15,288 KB
最終ジャッジ日時 2023-08-17 07:33:35
合計ジャッジ時間 2,368 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,224 KB
testcase_01 AC 83 ms
15,160 KB
testcase_02 AC 83 ms
15,004 KB
testcase_03 AC 84 ms
15,164 KB
testcase_04 AC 83 ms
15,288 KB
testcase_05 AC 83 ms
15,108 KB
testcase_06 AC 83 ms
15,160 KB
testcase_07 AC 84 ms
15,000 KB
testcase_08 AC 83 ms
15,108 KB
testcase_09 AC 84 ms
15,256 KB
testcase_10 AC 83 ms
15,120 KB
testcase_11 AC 84 ms
15,244 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s,n = gets.chomp.split(" ").map(&:to_i)
a = []
a << s
(n - 1).times { a << gets.chomp.to_i}
a = a.sort.reverse
z = a.index(s) + 1
case z % 10
when 1
    suffix = "st"
when 2
    suffix = "nd"
when 3
    suffix = "rd"
else
    suffix = "th"
end
puts "#{z}#{suffix}"
0