結果
| 問題 | No.227 簡単ポーカー |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-05 11:33:23 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 5,000 ms |
| コード長 | 1,200 bytes |
| コンパイル時間 | 1,075 ms |
| コンパイル使用メモリ | 114,968 KB |
| 実行使用メモリ | 26,508 KB |
| 最終ジャッジ日時 | 2024-07-03 08:05:00 |
| 合計ジャッジ時間 | 1,880 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
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");
}
}
}