結果

問題 No.227 簡単ポーカー
ユーザー harhogefoo
提出日時 2016-10-13 07:51:41
言語 Ruby
(3.4.1)
結果
AC  
実行時間 92 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-11-22 03:32:33
合計ジャッジ時間 2,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a = gets.chomp.split(" ")

h = Hash.new(0)
a.each do |card|
  h[card] += 1
end

three_card = false
two_pair_count = 0
h.each do |card, count|
  three_card = true if count == 3
  two_pair_count += 1 if count == 2
end

if three_card and two_pair_count == 1
  puts "FULL HOUSE"
elsif three_card
  puts "THREE CARD"
elsif two_pair_count == 2
  puts "TWO PAIR"
elsif two_pair_count == 1
  puts "ONE PAIR"
else
  puts "NO HAND"
end
0