結果

問題 No.227 簡単ポーカー
ユーザー laneguelanegue
提出日時 2020-04-05 11:33:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 1,200 bytes
コンパイル時間 1,405 ms
コンパイル使用メモリ 65,440 KB
実行使用メモリ 22,864 KB
最終ジャッジ日時 2023-09-16 06:32:25
合計ジャッジ時間 2,557 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
20,632 KB
testcase_01 AC 63 ms
20,768 KB
testcase_02 AC 62 ms
20,632 KB
testcase_03 AC 62 ms
20,628 KB
testcase_04 AC 63 ms
20,572 KB
testcase_05 AC 63 ms
22,664 KB
testcase_06 AC 62 ms
22,864 KB
testcase_07 AC 63 ms
20,712 KB
testcase_08 AC 62 ms
20,732 KB
testcase_09 AC 63 ms
22,752 KB
testcase_10 AC 63 ms
20,616 KB
testcase_11 AC 61 ms
18,728 KB
testcase_12 AC 61 ms
18,836 KB
testcase_13 AC 62 ms
20,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
public class Program
{
	static bool IsFullHouse(int[] a)
	{
		int x = Array.FindAll(a, n => n == a[0]).Length;
		int y = Array.FindAll(a, n => n == a[4]).Length;
		return (x == 2 && y == 3) || (x == 3 && y == 2);
	}
	static bool IsThreeCard(int[] a)
	{
		return Array.FindAll(a, n => n == a[2]).Length == 3;
	}
	static bool IsTwoPair(int[] a)
	{
		int x = Array.FindAll(a, n => n == a[1]).Length;
		int y = Array.FindAll(a, n => n == a[3]).Length;
		return x == 2 && y == 2;
	}
	static bool IsOnePair(int[] a)
	{
		int x = Array.FindAll(a, n => n == a[0]).Length;
		int y = Array.FindAll(a, n => n == a[2]).Length;
		int z = Array.FindAll(a, n => n == a[4]).Length;
		return x + y + z == 4;
	}
	static void Main()
	{
		int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), s => int.Parse(s));
		Array.Sort(a);
		Console.Error.WriteLine(String.Join(",", a));
		if (IsFullHouse(a))
		{
			Console.WriteLine("FULL HOUSE");
		}
		else if (IsThreeCard(a))
		{
			Console.WriteLine("THREE CARD");
		}
		else if (IsTwoPair(a))
		{
			Console.WriteLine("TWO PAIR");
		}
		else if (IsOnePair(a))
		{
			Console.WriteLine("ONE PAIR");
		}
		else
		{
			Console.WriteLine("NO HAND");
		}
	}
}
0