結果

問題 No.227 簡単ポーカー
ユーザー fujitafujita
提出日時 2023-04-28 10:55:36
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 1,999 bytes
コンパイル時間 7,437 ms
コンパイル使用メモリ 145,340 KB
実行使用メモリ 164,368 KB
最終ジャッジ日時 2023-08-11 00:34:05
合計ジャッジ時間 8,177 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
27,820 KB
testcase_01 AC 47 ms
28,088 KB
testcase_02 AC 48 ms
28,072 KB
testcase_03 AC 48 ms
28,028 KB
testcase_04 AC 48 ms
28,060 KB
testcase_05 AC 48 ms
27,940 KB
testcase_06 AC 47 ms
27,828 KB
testcase_07 AC 48 ms
27,852 KB
testcase_08 AC 47 ms
30,124 KB
testcase_09 AC 48 ms
27,944 KB
testcase_10 AC 48 ms
27,860 KB
testcase_11 AC 47 ms
28,352 KB
testcase_12 AC 48 ms
30,120 KB
testcase_13 AC 48 ms
164,368 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 119 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.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 && !(Hit[0] == twopair[0])|| twopair.Count == 3 && Hit.Count == 1 && !(Hit[0] == twopair[0]))
            {
                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