結果

問題 No.227 簡単ポーカー
ユーザー n.yn.y
提出日時 2022-06-08 09:17:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 2,033 bytes
コンパイル時間 1,393 ms
コンパイル使用メモリ 108,704 KB
実行使用メモリ 24,044 KB
最終ジャッジ日時 2023-10-21 04:00:00
合計ジャッジ時間 2,499 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,044 KB
testcase_01 AC 25 ms
24,044 KB
testcase_02 AC 25 ms
24,044 KB
testcase_03 AC 26 ms
24,044 KB
testcase_04 AC 26 ms
24,044 KB
testcase_05 AC 25 ms
24,044 KB
testcase_06 AC 26 ms
24,044 KB
testcase_07 AC 25 ms
24,044 KB
testcase_08 AC 26 ms
24,044 KB
testcase_09 AC 26 ms
24,044 KB
testcase_10 AC 26 ms
24,044 KB
testcase_11 AC 26 ms
24,044 KB
testcase_12 AC 26 ms
24,044 KB
testcase_13 AC 25 ms
24,044 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Diagnostics;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');

            int[] a = new int[5];
            //数字比較用配列
            int[] c = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            //入力した数字を配列に入れる
            for (int i = 0; i < 5; i++)
            {
                int A = int.Parse(str[i]);
                a[i] = A;
            }

            //数字がいくつあるか調べる あればカウント+1する
            int count = 0;
            for(int i=1;i<=13;i++)
            {
                for(int j=1;j<=5;j++)
                {
                    if(a[j-1]==i)
                    {
                        count += 1;
                        c[i - 1] += 1;
                    }
                }
            }


            int count1 = 0;
            //配列に2か3以外のカウントが入っているなら0にする
            //1が入っているならプラス1する
            for (int i = 1; i <= 13; i++)
            {
                if (c[i - 1] == 1)
                {
                    count1 += 1;
                    c[i - 1] = 0;

                }
                if (c[i - 1] == 5 || c[i - 1] == 4)
                {
                    count = 0;
                    break;
                }
            }

            int ans = count - count1;
            if (ans == 5)
            {
                Console.WriteLine("FULL HOUSE");
            }
            else if (ans == 4)
            {
                Console.WriteLine("TWO PAIR");
            }
            else if (ans == 3)
            {
                Console.WriteLine("THREE CARD");

            }
            else if (ans == 2)
            {
                Console.WriteLine("ONE PAIR");
            }
            else
            {
                Console.WriteLine("NO HAND");
            }

        }
    }
}
0