結果
| 問題 | No.564 背の順 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-28 10:42:06 |
| 言語 | Ruby (4.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2026-05-16 06:49:20 |
| 合計ジャッジ時間 | 1,587 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 3 |
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - i Syntax OK
ソースコード
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