結果

問題 No.564 背の順
ユーザー Lo_OTLo_OT
提出日時 2017-12-31 13:11:27
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 11,472 KB
実行使用メモリ 15,308 KB
最終ジャッジ日時 2023-08-23 12:25:28
合計ジャッジ時間 2,561 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,156 KB
testcase_01 AC 81 ms
15,236 KB
testcase_02 AC 81 ms
15,140 KB
testcase_03 WA -
testcase_04 AC 79 ms
15,220 KB
testcase_05 AC 79 ms
15,096 KB
testcase_06 AC 81 ms
15,212 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 82 ms
15,216 KB
testcase_10 AC 81 ms
15,016 KB
testcase_11 AC 81 ms
15,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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
0