結果

問題 No.227 簡単ポーカー
ユーザー gemmarogemmaro
提出日時 2020-04-19 19:58:51
言語 Elixir
(1.16.2)
結果
AC  
実行時間 607 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 1,110 ms
コンパイル使用メモリ 55,060 KB
実行使用メモリ 50,008 KB
最終ジャッジ日時 2023-08-30 00:33:15
合計ジャッジ時間 10,649 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 575 ms
49,296 KB
testcase_01 AC 567 ms
49,372 KB
testcase_02 AC 565 ms
49,412 KB
testcase_03 AC 558 ms
49,764 KB
testcase_04 AC 570 ms
49,164 KB
testcase_05 AC 563 ms
49,864 KB
testcase_06 AC 568 ms
49,636 KB
testcase_07 AC 570 ms
49,164 KB
testcase_08 AC 570 ms
49,244 KB
testcase_09 AC 585 ms
50,008 KB
testcase_10 AC 574 ms
49,816 KB
testcase_11 AC 570 ms
49,956 KB
testcase_12 AC 575 ms
49,664 KB
testcase_13 AC 607 ms
49,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

defmodule Main do
  def main do
    IO.read(:line)
    |> String.trim()
    |> String.split()
    |> Enum.map(&String.to_integer/1)
    |> solve
    |> IO.puts()
  end

  def solve(a) do
    a
    |> Enum.group_by(& &1)
    |> Map.values()
    |> Enum.map(&length/1)
    |> Enum.sort()
    |> judge
  end

  def judge(l) do
    case l do
      [2, 3] -> "FULL HOUSE"
      [1, 1, 3] -> "THREE CARD"
      [1, 2, 2] -> "TWO PAIR"
      [1, 1, 1, 2] -> "ONE PAIR"
      _ -> "NO HAND"
    end
  end
end
0