結果

問題 No.227 簡単ポーカー
ユーザー TaK7907TaK7907
提出日時 2017-10-22 06:35:41
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 1,843 bytes
コンパイル時間 3,064 ms
コンパイル使用メモリ 103,380 KB
実行使用メモリ 22,544 KB
最終ジャッジ日時 2023-08-13 17:02:26
合計ジャッジ時間 4,671 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
20,456 KB
testcase_01 AC 55 ms
22,472 KB
testcase_02 AC 54 ms
22,544 KB
testcase_03 AC 54 ms
20,432 KB
testcase_04 AC 55 ms
20,448 KB
testcase_05 AC 54 ms
20,468 KB
testcase_06 AC 54 ms
20,420 KB
testcase_07 AC 54 ms
20,556 KB
testcase_08 AC 53 ms
20,452 KB
testcase_09 AC 54 ms
20,460 KB
testcase_10 AC 54 ms
20,560 KB
testcase_11 AC 54 ms
20,476 KB
testcase_12 AC 54 ms
20,512 KB
testcase_13 AC 55 ms
20,496 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 yukicode {
    public class Program {
        public static string Solver(System.IO.TextReader reader) {
            var cards = reader.ReadLine().Split( ' ' );
            var map = new Dictionary<string, int>();
            foreach (var i in cards) {
                if (map.ContainsKey( i )) {
                    map[ i ] += 1;
                } else {
                    map.Add( i, 1 );
                }
            }
            if (map.ContainsValue( 3 )) {
                if (map.ContainsValue( 2 )) {
                    return "FULL HOUSE";
                } else {
                    return "THREE CARD";
                }
            } else if (map.ContainsValue( 2 )) {
                if (map.Count == 3) {
                    return "TWO PAIR";
                } else if (map.Count == 4) {
                    return "ONE PAIR";
                }
            }
            return "NO HAND";
        }

        private static void Main() {
            Console.WriteLine( Solver( Console.In ) );
        }
    }

    //--- MyLib ---
    public class MyLib {
        public static string Ordinalization(int num) {
            string[] surfix = { "st", "nd", "rd", "th" };
            return string.Format( "{0}{1}", num, 0 < num % 10 && num % 10 <= 4 ? surfix[ num % 10 - 1 ] : surfix[ 3 ] );
        }
        public static List<int> GetIntListFromTextReader(System.IO.TextReader reader, char delimitor) {
            return reader.ReadLine().Split( delimitor ).ToList<string>().ConvertAll<int>( int.Parse );
        }
        public static List<int> GetIntListFromTextReader(System.IO.TextReader reader, char[] delimitors) {
            return reader.ReadLine().Split( delimitors ).ToList<string>().ConvertAll<int>( int.Parse );
        }
    }
}
0