結果

問題 No.564 背の順
ユーザー mesh1nek0x0mesh1nek0x0
提出日時 2018-08-15 22:03:47
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 11,848 KB
実行使用メモリ 16,072 KB
最終ジャッジ日時 2023-10-24 17:32:33
合計ジャッジ時間 2,826 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
16,072 KB
testcase_01 AC 90 ms
16,072 KB
testcase_02 AC 90 ms
16,072 KB
testcase_03 WA -
testcase_04 AC 87 ms
16,072 KB
testcase_05 AC 88 ms
16,072 KB
testcase_06 AC 87 ms
16,072 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 92 ms
16,072 KB
testcase_10 AC 91 ms
16,072 KB
testcase_11 AC 89 ms
16,072 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/bin/ruby
H, N = gets.chomp.split(' ')

classmate = [H]
(N.to_i - 1).times do
  classmate.push(gets.chomp)
end

sorted = classmate.sort { |val1, val2| val2.to_i <=> val1.to_i }

if sorted[0] === H
  puts '1st'
elsif sorted[1] === H
  puts '2nd'
elsif sorted[2] === H
  puts '3rd'
else
  puts "#{sorted.index(H).to_i + 1}th"
end
0