結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-07 23:01:27 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 85 ms / 1,000 ms |
| コード長 | 222 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-09-19 18:30:54 |
| 合計ジャッジ時間 | 2,872 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - n Syntax OK
ソースコード
def suit_score(c)
%w[D C H S].index(c)
end
def letter_score(c)
%w[A 2 3 4 5 6 7 8 9 T J Q K].index(c)
end
n = gets.to_i
cards = gets.split
puts cards.sort_by { |s| [suit_score(s[0]), letter_score(s[1])] }.join(" ")