結果

問題 No.227 簡単ポーカー
ユーザー n.yn.y
提出日時 2022-06-07 16:55:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 1,976 bytes
コンパイル時間 790 ms
コンパイル使用メモリ 109,292 KB
実行使用メモリ 24,076 KB
最終ジャッジ日時 2023-10-21 03:50:25
合計ジャッジ時間 1,713 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
24,076 KB
testcase_01 AC 24 ms
24,076 KB
testcase_02 AC 23 ms
24,076 KB
testcase_03 AC 23 ms
24,076 KB
testcase_04 AC 21 ms
24,076 KB
testcase_05 AC 22 ms
24,076 KB
testcase_06 AC 22 ms
24,076 KB
testcase_07 AC 22 ms
24,076 KB
testcase_08 AC 22 ms
24,076 KB
testcase_09 AC 24 ms
24,076 KB
testcase_10 AC 23 ms
24,076 KB
testcase_11 AC 23 ms
24,076 KB
testcase_12 AC 21 ms
24,076 KB
testcase_13 AC 21 ms
24,076 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[] b = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
            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]==b[i-1])
                    {
                        count += 1;
                        c[i - 1] += 1;
                        
                    }
                }
            }

            int count1 = 0;
            //配列に2か3以外のカウントが入っているなら0にする
            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