結果

問題 No.564 背の順
ユーザー rkyrky
提出日時 2017-10-28 10:42:06
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-05-01 20:33:20
合計ジャッジ時間 1,685 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
12,160 KB
testcase_01 AC 76 ms
12,160 KB
testcase_02 AC 77 ms
12,416 KB
testcase_03 WA -
testcase_04 AC 77 ms
12,416 KB
testcase_05 AC 79 ms
12,160 KB
testcase_06 AC 84 ms
12,416 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 83 ms
12,288 KB
testcase_10 AC 81 ms
12,160 KB
testcase_11 AC 77 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

height, test_case = gets.chomp.split().map(&:to_i)
height_list = Array.new
for i in 0...(test_case - 1) do
	height_list << gets.chomp.to_i
end

height_list << height
height_list.sort!{|a, b| b <=> a }

res = 0 
height_list.each_with_index{ |element, value|
 if height == element 
 	res = value + 1 
 	break
 end
}
print res

if res == 1
	puts "st"
elsif res == 2
	puts "nd"
elsif res == 3
	puts "rd"
else
	puts "th"
end
0