結果

問題 No.227 簡単ポーカー
ユーザー Maeda
提出日時 2025-04-01 09:42:42
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 1,353 bytes
コンパイル時間 7,479 ms
コンパイル使用メモリ 170,772 KB
実行使用メモリ 187,868 KB
最終ジャッジ日時 2025-04-01 09:42:55
合計ジャッジ時間 9,178 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (97 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

    class Program
    {
        static void Main(string[] args)
        {
            int[] onHand = new int[13];
            string[] card = Console.ReadLine().Split(' ');
            for(int i = 0; i < 5; i++)
            {
                onHand[int.Parse(card[i])-1]++;
            }
            int countPAIR = 0;
            int countTHREE = 0;
            for(int i = 0; i < 13; i++)
            {
                if (onHand[i] == 2)
                {
                    countPAIR++;
                }else if (onHand[i] == 3)
                {
                    countTHREE++;
                }
            }

            Console.WriteLine(RoleJudgement(countTHREE, countPAIR));
        }

        private static string RoleJudgement(int countTHREE, int countPAIR)
        {
            if (countTHREE == 1 && countPAIR == 1)
            {
                return "FULL HOUSE";
            }
            else if (countTHREE == 1 && countPAIR == 0)
            {
                return "THREE CARD";
            }
            else if (countTHREE == 0 && countPAIR == 2)
            {
                return "TWO PAIR";
            }
            else if (countTHREE == 0 && countPAIR == 1)
            {
                return "ONE PAIR";
            }
            else
            {
                return "NO HAND";
            }
        }
    }
0