結果

問題 No.227 簡単ポーカー
ユーザー nanophoto12
提出日時 2015-12-17 23:45:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 922 bytes
コンパイル時間 878 ms
コンパイル使用メモリ 106,880 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-09-16 07:46:01
合計ジャッジ時間 1,777 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace No227
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var cards = Console.ReadLine ().Split (' ').Select (v => Convert.ToInt32 (v)).ToArray ();
			var dictionary = new Dictionary<int, int> ();
			foreach (var element in cards) {
				if (!dictionary.ContainsKey (element)) {
					dictionary.Add (element, 0);
				}
				dictionary [element]++;
			}
			if (dictionary.Any (element => element.Value == 3)) {
				if (dictionary.Any (element => element.Value == 2)) {
					Console.WriteLine ("FULL HOUSE");
					return;
				} 
				Console.WriteLine ("THREE CARD");
				return;
			}
			if (dictionary.Any (element => element.Value == 2)) {
				if (dictionary.Count() == 3) {
					Console.WriteLine ("TWO PAIR");
					return;
				} 
				Console.WriteLine ("ONE PAIR");
				return;
			}
			Console.WriteLine ("NO HAND");
		}
	}
}
0