nama = gets.split.map(&:to_i) heights = Array.new heights.push(1000) heights.push(nama[0]) nama[1].times do |i| heights[i + 1] = gets.to_i end heights = heights.sort.reverse if nama[0] == 1000 puts "1st" return end for i in 0...nama[1] if heights[i] > nama[0] && nama[0] > heights[i + 1] #puts "i : #{heights[i]} => #{nama[0]} =>#{heights[i + 1]}" case i when 0 puts "1st" when 1 puts "2nd" when 2 puts "3rd" else puts "#{i+1}th" end return end end