結果
問題 |
No.227 簡単ポーカー
|
ユーザー |
![]() |
提出日時 | 2019-03-18 15:40:18 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 28 ms / 5,000 ms |
コード長 | 1,521 bytes |
コンパイル時間 | 970 ms |
コンパイル使用メモリ | 114,028 KB |
実行使用メモリ | 25,208 KB |
最終ジャッジ日時 | 2024-07-18 10:19:44 |
合計ジャッジ時間 | 1,637 ms |
ジャッジサーバーID (参考情報) |
judge4 / 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; using System.Collections.Generic; using System.Linq; class Program { enum Role { NO_HAND, ONE_PAIR, TWO_PAIR, THREE_CARD, FULL_HOUSE } public void Solve() { 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]; } static void Main() { var solver = new Program(); solver.Solve(); } }