結果

問題 No.564 背の順
ユーザー jiro8719jiro8719
提出日時 2018-06-19 15:42:17
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 11,580 KB
実行使用メモリ 15,212 KB
最終ジャッジ日時 2023-09-13 07:08:47
合計ジャッジ時間 1,982 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,072 KB
testcase_01 AC 78 ms
15,176 KB
testcase_02 AC 77 ms
15,036 KB
testcase_03 AC 77 ms
15,212 KB
testcase_04 AC 76 ms
15,172 KB
testcase_05 AC 76 ms
15,124 KB
testcase_06 AC 77 ms
15,156 KB
testcase_07 AC 77 ms
15,124 KB
testcase_08 AC 78 ms
15,140 KB
testcase_09 AC 77 ms
15,156 KB
testcase_10 AC 77 ms
15,212 KB
testcase_11 AC 77 ms
15,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

input = gets.split(" ")
num = input[1].to_i
list = []
a = input[0].to_i
list << a

(num - 1).times do
    other = gets.to_i
    list << other
end
list.sort!
list.reverse!
b = (list.index(a) + 1).to_s[-1]

	case b.to_i
	when 1
		puts "#{list.index(a) + 1}st"
	when 2
		puts "#{list.index(a) + 1}nd"
	when 3
		puts "#{list.index(a) + 1}rd"
	else
		puts "#{list.index(a) + 1}th"
	end
0