結果

問題 No.227 簡単ポーカー
ユーザー shirano_cshirano_c
提出日時 2017-11-02 13:52:24
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,222 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 104,064 KB
実行使用メモリ 18,176 KB
最終ジャッジ日時 2024-05-02 03:07:44
合計ジャッジ時間 1,606 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
17,920 KB
testcase_01 AC 21 ms
18,048 KB
testcase_02 AC 20 ms
17,792 KB
testcase_03 AC 21 ms
18,176 KB
testcase_04 AC 21 ms
18,048 KB
testcase_05 AC 21 ms
17,792 KB
testcase_06 AC 21 ms
18,048 KB
testcase_07 WA -
testcase_08 AC 20 ms
17,920 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace simplepoker
{
    class Program
    {
        static void Main()
        {
                string nums = Console.ReadLine();
                string[] nospaceNums = nums.Split(' ');
                int[] cards = new int[5];
                int first, end, temp = 0;
                //int配列の中にstring配列の中身を入れる
                for (int i = 0; i < nospaceNums.Length; i++)
                {
                    cards[i] = Convert.ToInt32(nospaceNums[i]);
                }
                //cards配列の中身をバブルソート
                for (first = 0; first < cards.Length; first++)
                {
                    for (end = cards.Length - 1; end > first; end--)
                    {
                        if (cards[end] < cards[end - 1])
                        {
                            temp = cards[end - 1];
                            cards[end - 1] = cards[end];
                            cards[end] = temp;
                        }
                    }
                }

                //A1とA5が一致する場合は5カード
                //A1とA4が云々
                if (cards[0] == cards[4])
                    Console.WriteLine("NO HAND");
                else if (cards[0] == cards[3])
                    Console.WriteLine("NO HAND");
                //A1A4
                else if (cards[0] == cards[2])
                {
                    //A4A5が同じか
                    if (cards[3] == cards[4])
                    {
                        Console.WriteLine("FULL HOUSE");
                        return;
                    }
                    Console.WriteLine("THREE CARD");
                }
                //A1A2が同じか
                else if (cards[0] == cards[1])
                {
                    //A3A4が同じか
                    if (cards[2] == cards[3])
                    {
                        Console.WriteLine("TWO PAIR");
                        return;
                    }
                    Console.WriteLine("ONE PAIR");
                }
                else
                    //ブタ
                    Console.WriteLine("NO HAND");
        }
    }
}
0