結果

問題 No.227 簡単ポーカー
ユーザー miku_minatsukimiku_minatsuki
提出日時 2019-07-22 03:41:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 71 ms / 5,000 ms
コード長 1,662 bytes
コンパイル時間 3,833 ms
コンパイル使用メモリ 106,852 KB
実行使用メモリ 23,632 KB
最終ジャッジ日時 2023-09-05 14:47:31
合計ジャッジ時間 4,892 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
23,620 KB
testcase_01 AC 70 ms
21,736 KB
testcase_02 AC 69 ms
21,668 KB
testcase_03 AC 70 ms
21,668 KB
testcase_04 AC 70 ms
21,580 KB
testcase_05 AC 70 ms
21,608 KB
testcase_06 AC 71 ms
23,588 KB
testcase_07 AC 70 ms
21,616 KB
testcase_08 AC 70 ms
19,556 KB
testcase_09 AC 70 ms
21,572 KB
testcase_10 AC 71 ms
23,632 KB
testcase_11 AC 71 ms
21,632 KB
testcase_12 AC 70 ms
21,588 KB
testcase_13 AC 70 ms
21,796 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.Collections.Generic;
using System.IO;
using System.Linq;

public class Program
{
    private static readonly string currentPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
    private static readonly string testIn = "test_in";
    private static readonly string testOut = "test_out";

    public static void Main(string[] args)
    {
        string result = proc(Console.ReadLine().Split(' '));
        Console.WriteLine(result);
    }

    private static string proc(string[] args)
    {
        List<int> cards = new List<int>();
        foreach (string arg in args)
        {
            cards.Add(int.Parse(arg));
        }

        List<int> result = Search(cards);
        string hand = string.Empty;
        if (result.Contains(3) && result.Contains(2))
        {
            hand = "FULL HOUSE";
        }
        else if (result.Contains(3))
        {
            hand = "THREE CARD";
        }
        else if (result.Count(num => num == 2) == 2)
        {
            hand = "TWO PAIR";
        }
        else if (result.Count(num => num == 2) == 1)
        {
            hand = "ONE PAIR";
        }
        else
        {
            hand = "NO HAND";
        }

        return hand;
    }

    private static List<int> Search(List<int> cards)
    {
        List<int> result = new List<int>();
        for (int i = 1; i <= 13; i++)
        {
            int count = 0;
            foreach (int card in cards)
            {
                if (card == i)
                {
                    count++;
                }
            }
            result.Add(count);
        }

        return result;
    }
}
0