結果
| 問題 | No.227 簡単ポーカー | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-05-27 19:21:26 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 94 ms / 5,000 ms | 
| コード長 | 689 bytes | 
| コンパイル時間 | 349 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-12-26 03:10:35 | 
| 合計ジャッジ時間 | 2,680 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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?(3)
    if counts.include?(2)
        puts "FULL HOUSE"
    else
        puts "THREE CARD"
    end
elsif counts.include?(2)
    if counts.count(2) == 4
        puts "TWO PAIR"
    else
        puts "ONE PAIR"
    end
else
    puts "NO HAND"
end
            
            
            
        