結果

問題 No.227 簡単ポーカー
ユーザー fujitafujita
提出日時 2023-04-28 10:49:14
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,969 bytes
コンパイル時間 10,234 ms
コンパイル使用メモリ 168,568 KB
実行使用メモリ 183,772 KB
最終ジャッジ日時 2024-04-28 17:39:58
合計ジャッジ時間 11,670 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 50 ms
28,532 KB
testcase_02 AC 49 ms
28,160 KB
testcase_03 AC 49 ms
28,288 KB
testcase_04 AC 49 ms
28,288 KB
testcase_05 AC 49 ms
28,416 KB
testcase_06 AC 49 ms
28,160 KB
testcase_07 AC 48 ms
28,288 KB
testcase_08 AC 47 ms
28,416 KB
testcase_09 AC 48 ms
28,288 KB
testcase_10 AC 49 ms
28,288 KB
testcase_11 AC 48 ms
28,544 KB
testcase_12 AC 49 ms
28,288 KB
testcase_13 AC 49 ms
183,772 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (95 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System.Collections.Generic;
using System;
using System.Linq;
using System.Drawing;

namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var A = Console.ReadLine();
            var b = A.Split(" ");
            string[] str = new string[b.Length];
            List<string> Hit = new List<string>();
            List<string> twopair = new List<string>();

            for (int i = 0; i < str.Length; i++)
            {
                str[i] = b[i];
            }
            
            Array.Sort(str);
            
            for(int i = 0; i <= str.Length - 4; i++)
            {
                for (int j = 1 + i; j <= str.Length - 3; j++)
                {
                    if (str[i] == str[j])
                    {
                        Hit.Add(str[i]);
                    }
                }
            }

            for (int i = 2; i <= str.Length - 2; i++)
            {
                for (int j = 2 + i-1; j <= str.Length - 1 ; j++)
                {
                    if (str[i] == str[j])
                    {
                        twopair.Add(str[i]);
                    }
                }
            }




            if (Hit.Count == 3 && twopair.Count == 1 || twopair.Count == 3 && Hit.Count == 1)
            {
                Console.WriteLine("FULL HOUSE");
            }
            else if (Hit.Count == 3 && twopair.Count == 0 || twopair.Count == 3 && Hit.Count == 0)
            {
                Console.WriteLine("THREE CARD");
            }
            else if (Hit.Count == 1 && twopair.Count == 1 )
            {
                Console.WriteLine("TWO PAIR");
            }
            else if (Hit.Count == 1 && twopair.Count == 0 || twopair.Count == 1 && Hit.Count == 0)
            {
                Console.WriteLine("ONE PAIR");
            }
            else
            {
                Console.WriteLine("NO HAND");
            }
        }
    }
}
0