結果

問題 No.227 簡単ポーカー
コンテスト
ユーザー leafcup
提出日時 2023-03-03 19:07:08
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 54 ms / 5,000 ms
コード長 651 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 79 ms
コンパイル使用メモリ 8,960 KB
実行使用メモリ 14,848 KB
最終ジャッジ日時 2026-04-06 11:49:34
合計ジャッジ時間 1,461 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

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
0