結果
| 問題 | No.227 簡単ポーカー | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-06-07 16:55:38 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 25 ms / 5,000 ms | 
| コード長 | 1,976 bytes | 
| コンパイル時間 | 748 ms | 
| コンパイル使用メモリ | 112,896 KB | 
| 実行使用メモリ | 18,048 KB | 
| 最終ジャッジ日時 | 2024-09-21 04:53:36 | 
| 合計ジャッジ時間 | 1,610 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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");
            }
        }
    }
}
            
            
            
        