結果

問題 No.227 簡単ポーカー
ユーザー rio-yuasario-yuasa
提出日時 2023-05-27 19:21:26
言語 Ruby
(3.3.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 689 bytes
コンパイル時間 543 ms
コンパイル使用メモリ 11,372 KB
実行使用メモリ 15,288 KB
最終ジャッジ日時 2023-08-26 23:28:13
合計ジャッジ時間 2,372 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
15,256 KB
testcase_01 AC 72 ms
15,040 KB
testcase_02 AC 69 ms
15,288 KB
testcase_03 AC 72 ms
15,048 KB
testcase_04 AC 73 ms
15,144 KB
testcase_05 AC 71 ms
15,196 KB
testcase_06 AC 73 ms
15,044 KB
testcase_07 AC 73 ms
15,040 KB
testcase_08 AC 73 ms
15,216 KB
testcase_09 AC 71 ms
15,036 KB
testcase_10 AC 72 ms
14,936 KB
testcase_11 AC 76 ms
15,092 KB
testcase_12 AC 74 ms
15,088 KB
testcase_13 AC 77 ms
15,048 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?(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
0