結果
| 問題 | No.227 簡単ポーカー |
| コンテスト | |
| ユーザー |
kmtrc130
|
| 提出日時 | 2017-05-23 11:37:40 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 5,000 ms |
| コード長 | 1,349 bytes |
| コンパイル時間 | 3,399 ms |
| コンパイル使用メモリ | 107,648 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-09-19 11:39:14 |
| 合計ジャッジ時間 | 3,589 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.
ソースコード
using System;
using System.Linq;
class Program
{
enum Role
{
NO_HAND,
ONE_PAIR,
TWO_PAIR,
THREE_CARD,
FULL_HOUSE
}
static void Main(string[] args)
{
int[] A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
int[] cards = new int[14];
string ans = DisplayRole(Role.NO_HAND);
for (int i = 0; i < A.Length; i++)
{ cards[A[i]]++; }
for (int i = 0; i < cards.Length; i++)
{
if (cards[i] == 0) continue;
if (cards[i] == 2)
{
if (ans == DisplayRole(Role.ONE_PAIR)) { ans = DisplayRole(Role.TWO_PAIR); }
else if (ans == DisplayRole(Role.THREE_CARD)) { ans = DisplayRole(Role.FULL_HOUSE); }
else { ans =
DisplayRole(Role.ONE_PAIR); }
}
else if (cards[i] == 3)
{
if (ans == DisplayRole(Role.ONE_PAIR)) { ans = DisplayRole(Role.FULL_HOUSE); }
else { ans = DisplayRole(Role.THREE_CARD); }
}
}
Console.WriteLine(ans);
}
private static string DisplayRole(Role role)
{
string[] roleName = { "NO HAND", "ONE PAIR", "TWO PAIR", "THREE CARD", "FULL HOUSE" };
return roleName[(int)role];
}
}
kmtrc130