結果

問題 No.227 簡単ポーカー
ユーザー leafcupleafcup
提出日時 2023-03-03 19:07:08
言語 Ruby
(3.3.0)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 651 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 11,944 KB
実行使用メモリ 16,136 KB
最終ジャッジ日時 2023-10-18 01:12:54
合計ジャッジ時間 2,045 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
16,136 KB
testcase_01 AC 87 ms
16,136 KB
testcase_02 AC 85 ms
16,136 KB
testcase_03 AC 86 ms
16,136 KB
testcase_04 AC 83 ms
16,136 KB
testcase_05 AC 84 ms
16,128 KB
testcase_06 AC 84 ms
16,136 KB
testcase_07 AC 83 ms
16,136 KB
testcase_08 AC 82 ms
16,136 KB
testcase_09 AC 85 ms
16,136 KB
testcase_10 AC 83 ms
16,136 KB
testcase_11 AC 83 ms
16,136 KB
testcase_12 AC 84 ms
16,136 KB
testcase_13 AC 82 ms
16,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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