結果

問題 No.227 簡単ポーカー
ユーザー mban
提出日時 2016-11-05 13:26:19
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 1,348 bytes
コンパイル時間 1,178 ms
コンパイル使用メモリ 111,488 KB
実行使用メモリ 27,244 KB
最終ジャッジ日時 2024-11-25 03:06:46
合計ジャッジ時間 2,223 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
using System.Text;
using System.Threading.Tasks;

class Magatro
{
    static void Main()
    {
        int[] cnt = new int[13];
        int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        for(int i = 0; i < 5; i++)
        {
            cnt[a[i] - 1]++;
        }
        int q = 0;
        for(int i = 0; i < 13; i++)
        {
            switch (q)
            {
                case 0:
                    if (cnt[i] == 2)
                    {
                        q=1;
                    }
                    if (cnt[i] == 3)
                    {
                        q = 3;
                    }
                    break;
                case 1:
                    if (cnt[i] == 2)
                    {
                        q = 2;
                    }
                    if (cnt[i] == 3)
                    {
                        q = 4;
                    }
                    break;
                case 3:
                    if (cnt[i] == 2)
                    {
                        q = 4;
                    }
                    break;
            }
        }
        string[] ans = new string[5] { "NO HAND", "ONE PAIR", "TWO PAIR", "THREE CARD", "FULL HOUSE" };
        Console.WriteLine(ans[q]);
    } 
}
0