結果
| 問題 | No.227 簡単ポーカー | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-03-03 19:07:08 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 83 ms / 5,000 ms | 
| コード長 | 651 bytes | 
| コンパイル時間 | 286 ms | 
| コンパイル使用メモリ | 7,552 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-09-17 22:12:29 | 
| 合計ジャッジ時間 | 1,872 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 | 
コンパイルメッセージ
Syntax OK
ソースコード
cards = gets.chomp           # 文字列の入力を受け付ける
            .split             # 文字列を空白文字で分割して配列にする
            .map { _1.to_i }   # 配列の要素を数値にする
count0 = cards.count(cards[0])
count1 = cards.count(cards[1])
count2 = cards.count(cards[2])
count3 = cards.count(cards[3])
count4 = cards.count(cards[4])
counts = [count0, count1, count2, count3, count4]
if counts.include?(2)
  if counts.include?(3)
    puts "FULL HOUSE"
  elsif counts.count(2) == 4
    puts "TWO PAIR"
  else
    puts "ONE PAIR"
  end
elsif counts.include?(3)
  puts "THREE CARD"
else
  puts "NO HAND"
end
            
            
            
        